Skip to content

Commit

Permalink
fix(@ngtools/webpack): normalize paths when adding file dependencies
Browse files Browse the repository at this point in the history
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
  • Loading branch information
alan-agius4 authored and filipesilva committed May 31, 2021
1 parent 494cca6 commit 3afa556
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/ngtools/webpack/src/ivy/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,9 @@ export class AngularWebpackPlugin {
continue;
}

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

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

0 comments on commit 3afa556

Please sign in to comment.