Skip to content

Commit 1c61ced

Browse files
clydinalan-agius4
authored andcommitted
fix(@angular-devkit/build-webpack): avoid deprecation warning with Webpack 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.
1 parent dcad2ee commit 1c61ced

File tree

2 files changed

+2
-2
lines changed
  • packages/angular_devkit/build_webpack/src

2 files changed

+2
-2
lines changed

packages/angular_devkit/build_webpack/src/webpack-dev-server/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export function runWebpackDevServer(
6868
// Disable stats reporting by the devserver, we have our own logger.
6969
devServerConfig.stats = false;
7070

71-
return createWebpack(config).pipe(
71+
return createWebpack({ ...config, watch: false }).pipe(
7272
switchMap(webpackCompiler => new Observable<DevServerBuildOutput>(obs => {
7373
const server = createWebpackDevServer(webpackCompiler, devServerConfig);
7474
let result: DevServerBuildOutput;

packages/angular_devkit/build_webpack/src/webpack/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export function runWebpack(
5050
const log: WebpackLoggingCallback = options.logging
5151
|| ((stats, config) => context.logger.info(stats.toString(config.stats)));
5252

53-
return createWebpack(config).pipe(
53+
return createWebpack({ ...config, watch: false }).pipe(
5454
switchMap(webpackCompiler => new Observable<BuildResult>(obs => {
5555
const callback = (err?: Error, stats?: webpack.Stats) => {
5656
if (err) {

0 commit comments

Comments
 (0)