watchOptions required for use in docker environment

This will work in both docker and outside of docker, and tunes the load on a docker container running webpack to not overly burden a local host’s cpu watching for changes. By default, webpack-dev-middleware is supposed to be watching, but in practice this seems to not be the case in docker containers, as fsevents are not passed through the NFS mount into a container and it requires explicit polling to enable watching for changes.
parent 41242c3a
...@@ -21,7 +21,15 @@ routes.forEach(route => { ...@@ -21,7 +21,15 @@ routes.forEach(route => {
app.get(route.pattern, handler(route)); app.get(route.pattern, handler(route));
}); });
app.use(webpackDevMiddleware(compiler)); app.use(webpackDevMiddleware(compiler,
{
watchOptions: {
aggregateTimeout: 500,
poll: 2500,
ignored: ['node_modules','build']
}
}
));
var proxyHost = process.env.FALLBACK || ''; var proxyHost = process.env.FALLBACK || '';
if (proxyHost !== '') { if (proxyHost !== '') {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment