Skip to content
This repository was archived by the owner on Apr 8, 2020. It is now read-only.

Commit c0205cf

Browse files
pglazkovSteveSandersonMS
authored andcommitted
Fix watchOptions in webpack.config.js being ignored by WebpackDevMiddleware (#806)
This enables Docker HMR workflow and the workaround mentioned in this comment: #806 (comment)
1 parent b28f852 commit c0205cf

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/Microsoft.AspNetCore.SpaServices/npm/aspnet-webpack/src/WebpackDevMiddleware.ts

+3-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ function attachWebpackDevMiddleware(app: any, webpackConfig: webpack.Configurati
108108
const compiler = webpack(webpackConfig);
109109
app.use(require('webpack-dev-middleware')(compiler, {
110110
noInfo: true,
111-
publicPath: webpackConfig.output.publicPath
111+
publicPath: webpackConfig.output.publicPath,
112+
watchOptions: webpackConfig.watchOptions
112113
}));
113114

114115
// After each compilation completes, copy the in-memory filesystem to disk.
@@ -207,7 +208,7 @@ function pathJoinSafe(rootPath: string, filePath: string) {
207208

208209
function beginWebpackWatcher(webpackConfig: webpack.Configuration) {
209210
const compiler = webpack(webpackConfig);
210-
compiler.watch({ /* watchOptions */ }, (err, stats) => {
211+
compiler.watch(webpackConfig.watchOptions || {}, (err, stats) => {
211212
// The default error reporter is fine for now, but could be customized here in the future if desired
212213
});
213214
}

0 commit comments

Comments
 (0)