Skip to content

Commit

Permalink
fix(@ngtools/webpack): normalize paths when pruning AOT rebuild requests
Browse files Browse the repository at this point in the history
  • Loading branch information
clydin authored and alan-agius4 committed Feb 18, 2021
1 parent eeec921 commit 9c19ca4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions packages/ngtools/webpack/src/ivy/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ export class AngularWebpackPlugin {
!ignoreForEmit.has(sourceFile) &&
!angularCompiler.incrementalDriver.safeToSkipEmit(sourceFile)
) {
this.requiredFilesToEmit.add(sourceFile.fileName);
this.requiredFilesToEmit.add(normalizePath(sourceFile.fileName));
}
}

Expand All @@ -500,7 +500,7 @@ export class AngularWebpackPlugin {
mergeTransformers(angularCompiler.prepareEmit().transformers, transformers),
getDependencies,
(sourceFile) => {
this.requiredFilesToEmit.delete(sourceFile.fileName);
this.requiredFilesToEmit.delete(normalizePath(sourceFile.fileName));
angularCompiler.incrementalDriver.recordSuccessfulEmit(sourceFile);
},
);
Expand Down Expand Up @@ -589,11 +589,12 @@ export class AngularWebpackPlugin {
onAfterEmit?: (sourceFile: ts.SourceFile) => void,
): FileEmitter {
return async (file: string) => {
if (this.requiredFilesToEmitCache.has(file)) {
return this.requiredFilesToEmitCache.get(file);
const filePath = normalizePath(file);
if (this.requiredFilesToEmitCache.has(filePath)) {
return this.requiredFilesToEmitCache.get(filePath);
}

const sourceFile = program.getSourceFile(file);
const sourceFile = program.getSourceFile(filePath);
if (!sourceFile) {
return undefined;
}
Expand All @@ -620,7 +621,7 @@ export class AngularWebpackPlugin {
if (content !== undefined && this.watchMode) {
// Capture emit history info for Angular rebuild analysis
hash = hashContent(content);
this.fileEmitHistory.set(file, { length: content.length, hash });
this.fileEmitHistory.set(filePath, { length: content.length, hash });
}

const dependencies = [
Expand Down

0 comments on commit 9c19ca4

Please sign in to comment.