Skip to content

Commit

Permalink
Fix production build and production server
Browse files Browse the repository at this point in the history
  • Loading branch information
villetou committed Feb 11, 2016
1 parent 053d102 commit c620fde
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
}]
}]
]
},
"production": {
"plugins": []
}
}
}
5 changes: 4 additions & 1 deletion config/webpack/prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var config = {
},

debug: false,
//devtool: 'cheap-module-eval-source-map',

resolve: {
root: common.paths.ROOT,
extensions: ['.', '', '.webpack.js', '.web.js', '.jsx', '.js']
Expand All @@ -66,6 +66,9 @@ var config = {
},
plugins: [
//new webpack.HotModuleReplacementPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': '"production"'
}),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"scripts": {
"start": "node dev_server",
"production": "node server",
"deploy": "webpack -p --config config/webpack/prod.js"
"deploy": "NODE_ENV=production webpack -p --config config/webpack/prod.js"
},
"dependencies": {
"app-module-path": "^1.0.5",
Expand Down
6 changes: 6 additions & 0 deletions server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ const settings = getSettings()
const app = express()
const passport = getPassport(settings)

app.use('/', express.static(path.resolve(__dirname, '..', 'dist')));

app.get('/', function (req, res) {
res.sendfile(path.resolve(__dirname, '..', 'dist'));
});

app.use(cookieParser());
app.use(bodyParser.urlencoded({extended: true}));
app.use(cookieSession({name: 's', secret: settings.sessionSecret, maxAge: 86400 * 1000}));
Expand Down

0 comments on commit c620fde

Please sign in to comment.