Skip to content

Commit 509091a

Browse files
committed
fix(@ngtools/webpack): invalidate all the files changed
Webpack only passes the first file that was changed. If there are multiple, we need to validate all of them. For that we result to listening to Watchpack directly.
1 parent b8328dc commit 509091a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/@ngtools/webpack/src/plugin.ts

+4-2
Original file line numberDiff line numberDiff line change
@@ -237,12 +237,14 @@ export class AotPlugin implements Tapable {
237237
apply(compiler: any) {
238238
this._compiler = compiler;
239239

240-
compiler.plugin('invalid', (fileName: string) => {
240+
compiler.plugin('invalid', () => {
241241
// Turn this off as soon as a file becomes invalid and we're about to start a rebuild.
242242
this._firstRun = false;
243243
this._diagnoseFiles = {};
244244

245-
this._compilerHost.invalidate(fileName);
245+
compiler.watchFileSystem.watcher.once('aggregated', (changes) => {
246+
changes.forEach((fileName: string) => this._compilerHost.invalidate(fileName));
247+
});
246248
});
247249

248250
// Add lazy modules to the context module for @angular/core/src/linker

0 commit comments

Comments
 (0)