diff --git a/webpack.config.js b/webpack.config.js index 6fee57ab..6670f417 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -34,6 +34,7 @@ module.exports = (env, options) => { const envVersion = env.version; const hasEnvVersion = (envVersion != null && typeof envVersion === 'string'); + const watch = env.WEBPACK_WATCH; const cssConfig = { test: /\.(sa|sc|c)ss$/, @@ -87,7 +88,7 @@ module.exports = (env, options) => { dev: !prod // Built-in HMR }, emitCss: false, - hotReload: !prod, + hotReload: !prod && watch, preprocess } } @@ -142,16 +143,18 @@ module.exports = (env, options) => { config.devtool = false; } else { config.devtool = 'eval-cheap-module-source-map'; - config.plugins.push(new webpack.HotModuleReplacementPlugin(), extReloader); - // config.devServer = { - // host: 'localhost', - // port: 6000, - // hot: true, - // contentBase: path.join(__dirname, 'build'), - // headers: { 'Access-Control-Allow-Origin': '*' }, - // writeToDisk: true, - // disableHostCheck: true - // }; + if (watch) { + config.plugins.push(new webpack.HotModuleReplacementPlugin(), extReloader); + // config.devServer = { + // host: 'localhost', + // port: 6000, + // hot: true, + // contentBase: path.join(__dirname, 'build'), + // headers: { 'Access-Control-Allow-Origin': '*' }, + // writeToDisk: true, + // disableHostCheck: true + // }; + } } return config;