Accélération de la compilation Webpack en dev

pull/171/head
mama 2018-02-14 16:01:37 +01:00
parent a1207883b1
commit 92f37cd5ce
2 changed files with 11 additions and 2 deletions

View File

@ -83,6 +83,7 @@
"fantasy-land": "^3.3.0",
"fantasy-tuples": "^1.0.0",
"file-loader": "^1.1.6",
"hard-source-webpack-plugin": "^0.5.18",
"html-loader": "^0.5.1",
"img-loader": "^2.0.0",
"jsdom": "^11.0.0",

View File

@ -1,6 +1,7 @@
var webpack = require('webpack'),
path = require('path'),
prodEnv = process.env.NODE_ENV == 'production' // eslint-disable-line no-undef
prodEnv = process.env.NODE_ENV == 'production', // eslint-disable-line no-undef
HardSourceWebpackPlugin = require('hard-source-webpack-plugin')
module.exports = {
devtool: 'cheap-module-source-map',
@ -92,6 +93,13 @@ module.exports = {
new webpack.EnvironmentPlugin({ NODE_ENV: 'development' }),
new webpack.NoEmitOnErrorsPlugin()
]
.concat(!prodEnv ? [new webpack.HotModuleReplacementPlugin()] : [])
.concat(
!prodEnv
? [
new webpack.HotModuleReplacementPlugin(),
new HardSourceWebpackPlugin()
]
: []
)
.concat(prodEnv ? [new webpack.optimize.UglifyJsPlugin()] : [])
}