Disable hot reloading on production builds

derp
This commit is contained in:
Drew DeVault 2018-03-03 15:41:22 -05:00
parent b0916a59f6
commit f8adaed4a0
2 changed files with 5 additions and 3 deletions

View File

@ -5,7 +5,7 @@
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"build": "webpack", "build": "webpack",
"build:production": "webpack -p --optimize-minimize", "build:production": "ENVIRONMENT=production webpack -p --optimize-minimize",
"watch": "webpack --progress --watch", "watch": "webpack --progress --watch",
"start": "node serve.js" "start": "node serve.js"
}, },

View File

@ -5,6 +5,8 @@ const defines = {
"DEFAULT_WS_URI": process.env.WEBSOCKET_URI || "ws://localhost:8412/" "DEFAULT_WS_URI": process.env.WEBSOCKET_URI || "ws://localhost:8412/"
}; };
const env = process.env.ENVIRONMENT || "development";
module.exports = { module.exports = {
devtool: "source-map", devtool: "source-map",
entry: [ entry: [
@ -50,10 +52,10 @@ module.exports = {
] ]
}, },
plugins:[ plugins:[
new webpack.HotModuleReplacementPlugin(), (env !== "production" && new webpack.HotModuleReplacementPlugin()),
new webpack.EnvironmentPlugin(defines), new webpack.EnvironmentPlugin(defines),
new webpack.NamedModulesPlugin(), new webpack.NamedModulesPlugin(),
], ].filter(p => p),
resolve: { resolve: {
alias: { alias: {
"react": "preact-compat", "react": "preact-compat",