Disable webpack-dev-server polling by default.

This commit is contained in:
orangemug 2017-11-03 11:04:15 +00:00
parent d502d9b1bb
commit da0b4d7911
2 changed files with 9 additions and 2 deletions

View file

@ -41,7 +41,14 @@ module.exports = {
// serve index.html in place of 404 responses to allow HTML5 history // serve index.html in place of 404 responses to allow HTML5 history
historyApiFallback: true, historyApiFallback: true,
port: PORT, port: PORT,
host: HOST host: HOST,
watchOptions: {
// Disabled polling by default as it causes lots of CPU usage and hence drains laptop batteries. To enable polling add WEBPACK_DEV_SERVER_POLLING to your environment
// See <https://webpack.js.org/configuration/watch/#watchoptions-poll> for details
poll: (!!process.env.WEBPACK_DEV_SERVER_POLLING ? true : false),
watch: false,
ignored: /node_modules/
}
}, },
plugins: [ plugins: [
new webpack.NoErrorsPlugin(), new webpack.NoErrorsPlugin(),

View file

@ -8,7 +8,7 @@
"build": "webpack --config config/webpack.production.config.js --progress --profile --colors", "build": "webpack --config config/webpack.production.config.js --progress --profile --colors",
"test": "wdio config/wdio.conf.js", "test": "wdio config/wdio.conf.js",
"test-watch": "wdio config/wdio.conf.js --watch", "test-watch": "wdio config/wdio.conf.js --watch",
"start": "webpack-dev-server --progress --profile --colors --watch-poll --config config/webpack.config.js", "start": "webpack-dev-server --progress --profile --colors --config config/webpack.config.js",
"lint": "eslint --ext js --ext jsx {src,test}", "lint": "eslint --ext js --ext jsx {src,test}",
"lint-styles": "stylelint 'src/styles/*.scss'" "lint-styles": "stylelint 'src/styles/*.scss'"
}, },