Skip to content
This repository has been archived by the owner on Nov 10, 2017. It is now read-only.

Commit

Permalink
Skips hot reload in production.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gongreg committed Mar 23, 2017
1 parent 084d3ec commit 20eab47
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/server/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export default function ({projectDir, configDir, ...options}) {
// Build the webpack configuration using the `baseConfig`
// custom `.babelrc` file and `webpack.config.js` files
const environment = options.environment || 'DEVELOPMENT';
const currentWebpackConfig = environment === 'PRODUCTION' ? baseProductionConfig : baseConfig;
const isProd = environment === 'PRODUCTION';
const currentWebpackConfig = isProd ? baseProductionConfig : baseConfig;
const config = loadConfig(environment, currentWebpackConfig, projectDir, configDir);

// remove the leading '/'
Expand All @@ -46,7 +47,10 @@ export default function ({projectDir, configDir, ...options}) {
middlewareFn(router);

router.use(webpackDevMiddleware(compiler, devMiddlewareOptions));
router.use(webpackHotMiddleware(compiler));

if (!isProd) {
router.use(webpackHotMiddleware(compiler));
}

router.get('/', function (req, res) {
res.send(getIndexHtml(publicPath, {
Expand Down

0 comments on commit 20eab47

Please sign in to comment.