Skip to content

Commit

Permalink
fix(@angular-devkit/build-webpack): avoid deprecation warning with We…
Browse files Browse the repository at this point in the history
…bpack 5 watch mode

With Webpack 5, passing the watch configuration option into the `webpack` factory function will cause the Webpack compiler to assume it should immediately start watching which requires a callback to be passed as well.  Since the execution of the compiler is handled later in the process, a callback at the compiler creation stage is undesirable and could result in potentially breaking changes to accomplish.
  • Loading branch information
clydin authored and alan-agius4 committed Sep 30, 2020
1 parent dcad2ee commit 1c61ced
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Expand Up @@ -68,7 +68,7 @@ export function runWebpackDevServer(
// Disable stats reporting by the devserver, we have our own logger.
devServerConfig.stats = false;

return createWebpack(config).pipe(
return createWebpack({ ...config, watch: false }).pipe(
switchMap(webpackCompiler => new Observable<DevServerBuildOutput>(obs => {
const server = createWebpackDevServer(webpackCompiler, devServerConfig);
let result: DevServerBuildOutput;
Expand Down
2 changes: 1 addition & 1 deletion packages/angular_devkit/build_webpack/src/webpack/index.ts
Expand Up @@ -50,7 +50,7 @@ export function runWebpack(
const log: WebpackLoggingCallback = options.logging
|| ((stats, config) => context.logger.info(stats.toString(config.stats)));

return createWebpack(config).pipe(
return createWebpack({ ...config, watch: false }).pipe(
switchMap(webpackCompiler => new Observable<BuildResult>(obs => {
const callback = (err?: Error, stats?: webpack.Stats) => {
if (err) {
Expand Down

0 comments on commit 1c61ced

Please sign in to comment.