Fix watchOptions in webpack.config.js being ignored by WebpackDevMiddleware (#806)

This enables Docker HMR workflow and the workaround mentioned in this comment: https://github.com/aspnet/JavaScriptServices/issues/806#issuecomment-290081291
This commit is contained in:
Pavlo Glazkov
2017-04-08 13:34:19 +02:00
committed by Steve Sanderson
parent b28f85236f
commit c0205cfc4e

View File

@@ -108,7 +108,8 @@ function attachWebpackDevMiddleware(app: any, webpackConfig: webpack.Configurati
const compiler = webpack(webpackConfig);
app.use(require('webpack-dev-middleware')(compiler, {
noInfo: true,
publicPath: webpackConfig.output.publicPath
publicPath: webpackConfig.output.publicPath,
watchOptions: webpackConfig.watchOptions
}));
// After each compilation completes, copy the in-memory filesystem to disk.
@@ -207,7 +208,7 @@ function pathJoinSafe(rootPath: string, filePath: string) {
function beginWebpackWatcher(webpackConfig: webpack.Configuration) {
const compiler = webpack(webpackConfig);
compiler.watch({ /* watchOptions */ }, (err, stats) => {
compiler.watch(webpackConfig.watchOptions || {}, (err, stats) => {
// The default error reporter is fine for now, but could be customized here in the future if desired
});
}