Skip to content

Commit 3afa556

Browse files
alan-agius4filipesilva
authored andcommitted
fix(@ngtools/webpack): normalize paths when adding file dependencies
This caused Webpack to mark all TypeScript files as removed after the first compilation on Windows because the file separators didn't match Closes #20891
1 parent 494cca6 commit 3afa556

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,9 @@ export class AngularWebpackPlugin {
268268
continue;
269269
}
270270

271-
// Ensure all program files are considered part of the compilation and will be watched
272-
compilation.fileDependencies.add(sourceFile.fileName);
271+
// Ensure all program files are considered part of the compilation and will be watched.
272+
// Webpack does not normalize paths. Therefore, we need to normalize the path with FS seperators.
273+
compilation.fileDependencies.add(externalizePath(sourceFile.fileName));
273274

274275
// Add all non-declaration files to the initial set of unused files. The set will be
275276
// analyzed and pruned after all Webpack modules are finished building.

0 commit comments

Comments
 (0)