Skip to content

Commit ff87570

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 (cherry picked from commit 3afa556)
1 parent 8bee9cb commit ff87570

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,9 @@ export class AngularWebpackPlugin {
266266
continue;
267267
}
268268

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

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

0 commit comments

Comments
 (0)