diff --git a/README.md b/README.md index ea44fc8..597d144 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,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 diff --git a/config/webpack.config.js b/config/webpack.config.js index a50402a..a0f80f8 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -41,7 +41,13 @@ 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 + } }, 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'" },