webpack-dev-middleware was configured with lazy: true (the default value for this option), and was not running webpack in watch mode as a result. This is why we weren't getting incremental builds and were stuck with 60-second compilation cycles on every change.
Proxy
Turns out that webpack-dev-server has a proxy option which makes using webpack-dev-middleware irrelevant. This gets rid of the following dependencies: express, http-proxy and webpack-dev-middleware and of the WEBPACK_SERVER_PORT environment variable.
Hot Module Replacement
Even though HMR was properly configured and I got incremental builds to work, the page was still reloading on every change. This was caused by the ExtractTextPlugin. Using this plugin only for production builds fixed the issue and resulted in a significant speed improvement on initial build (from 60 sec to about 12 sec).
Additional improvements
use DedupePlugin in production
remove -p flag from build script command, as it has no effect (we add the plugins manually in the config in order to disable uglify warnings)
add index.scss to the entries of each target in the webpack config instead of requiring it from target.js - this is the first step towards removing all target.js files
Lots of stuff going on here! Fix #754
Incremental builds
webpack-dev-middleware
was configured withlazy: true
(the default value for this option), and was not running webpack in watch mode as a result. This is why we weren't getting incremental builds and were stuck with 60-second compilation cycles on every change.Proxy
Turns out that
webpack-dev-server
has aproxy
option which makes usingwebpack-dev-middleware
irrelevant. This gets rid of the following dependencies:express
,http-proxy
andwebpack-dev-middleware
and of theWEBPACK_SERVER_PORT
environment variable.Hot Module Replacement
Even though HMR was properly configured and I got incremental builds to work, the page was still reloading on every change. This was caused by the
ExtractTextPlugin
. Using this plugin only for production builds fixed the issue and resulted in a significant speed improvement on initial build (from 60 sec to about 12 sec).Additional improvements
DedupePlugin
in production-p
flag frombuild
script command, as it has no effect (we add the plugins manually in the config in order to disable uglify warnings)index.scss
to the entries of each target in the webpack config instead of requiring it fromtarget.js
- this is the first step towards removing alltarget.js
filesstart
script to runProcfile.hot
npm run build