From da0b4d79119202799ba066d59f51f27978ab74ce Mon Sep 17 00:00:00 2001 From: orangemug Date: Fri, 3 Nov 2017 11:04:15 +0000 Subject: [PATCH 1/3] Disable webpack-dev-server polling by default. --- config/webpack.config.js | 9 ++++++++- package.json | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/config/webpack.config.js b/config/webpack.config.js index a50402a..1fc02d5 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -41,7 +41,14 @@ module.exports = { // serve index.html in place of 404 responses to allow HTML5 history historyApiFallback: true, 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 for details + poll: (!!process.env.WEBPACK_DEV_SERVER_POLLING ? true : false), + watch: false, + ignored: /node_modules/ + } }, plugins: [ new webpack.NoErrorsPlugin(), diff --git a/package.json b/package.json index 260623b..5b1beb4 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,7 @@ "build": "webpack --config config/webpack.production.config.js --progress --profile --colors", "test": "wdio config/wdio.conf.js", "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-styles": "stylelint 'src/styles/*.scss'" }, From ea5568717110c31f34eb0fea38a2ab701a813cfa Mon Sep 17 00:00:00 2001 From: orangemug Date: Fri, 3 Nov 2017 11:12:23 +0000 Subject: [PATCH 2/3] Added note to the docs regarding `WEBPACK_DEV_SERVER_POLLING` --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 27f86ac..8c5edbb 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,12 @@ npm install npm start ``` -Build a production package for distribution. +The build process will watch for changes to the filesystem, rebuild and autoreload the editor. However note this from the webpack-dev-server docs + +> webpack uses the file system to get notified of file changes. In some cases this does not work. For example, when using Network File System (NFS). Vagrant also has a lot of problems with this. +Snippet from + +To enable polling add `export WEBPACK_DEV_SERVER_POLLING=1` to your enviroment. ``` npm run build From 89f6343abd50f645b2b7093a8f230c2112824faf Mon Sep 17 00:00:00 2001 From: orangemug Date: Sat, 4 Nov 2017 14:24:36 +0000 Subject: [PATCH 3/3] Removed ignoring node_modules in webpack watch --- config/webpack.config.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/config/webpack.config.js b/config/webpack.config.js index 1fc02d5..a0f80f8 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -46,8 +46,7 @@ module.exports = { // 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 for details poll: (!!process.env.WEBPACK_DEV_SERVER_POLLING ? true : false), - watch: false, - ignored: /node_modules/ + watch: false } }, plugins: [