From 33ca65aaa80c22c708c64a19f0374f5493244995 Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Wed, 21 Apr 2021 10:11:17 +0200 Subject: [PATCH] fix(@angular-devkit/build-angular): avoid triggering file change after file build When using the `ContextReplacementPlugin` https://github.com/angular/angular-cli/blob/master/packages/angular_devkit/build_angular/src/webpack/configs/common.ts#L496 the new resource path will be watched by Webpack file watcher. This causes a redundant file remove event after the first build, which causes another partial rebuild right way. Note: changing the call to ` new ContextReplacementPlugin(/\@angular(\\|\/)core(\\|\/)/);` doesn't address the problem. (cherry picked from commit eed56ab839b6b9b5281f2405c6096073ff4d9103) --- .../angular_devkit/build_angular/src/webpack/utils/helpers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/angular_devkit/build_angular/src/webpack/utils/helpers.ts b/packages/angular_devkit/build_angular/src/webpack/utils/helpers.ts index 832a2bc15a49..e133a495dd91 100644 --- a/packages/angular_devkit/build_angular/src/webpack/utils/helpers.ts +++ b/packages/angular_devkit/build_angular/src/webpack/utils/helpers.ts @@ -121,7 +121,7 @@ export function isPolyfillsEntry(name: string): boolean { export function getWatchOptions(poll: number | undefined): Configuration['watchOptions'] { return { poll, - ignored: poll === undefined ? undefined : 'node_modules/**', + ignored: poll === undefined ? '**/$_lazy_route_resources' : 'node_modules/**', }; }