Skip to content

Commit

Permalink
fix(@ngtools/webpack): normalize file replacement paths
Browse files Browse the repository at this point in the history
To ensure file replacements match properly, the paths now have their directory separators normalized before comparing.
  • Loading branch information
clydin authored and alan-agius4 committed Nov 5, 2020
1 parent 6703a7f commit d7ba0cf
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/ngtools/webpack/src/ivy/host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,13 @@ export function augmentHostWithReplacements(
return;
}

const normalizedReplacements: Record<string, string> = {};
for (const [key, value] of Object.entries(replacements)) {
normalizedReplacements[forwardSlashPath(key)] = forwardSlashPath(value);
}

const tryReplace = (resolvedModule: ts.ResolvedModule | undefined) => {
const replacement = resolvedModule && replacements[resolvedModule.resolvedFileName];
const replacement = resolvedModule && normalizedReplacements[resolvedModule.resolvedFileName];
if (replacement) {
return {
resolvedFileName: replacement,
Expand Down

0 comments on commit d7ba0cf

Please sign in to comment.