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 filipesilva committed Feb 17, 2021
1 parent 789e05d commit c6e65e4
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 @@ -492,7 +492,7 @@ export class AngularWebpackPlugin {
!ignoreForEmit.has(sourceFile) &&
!angularCompiler.incrementalDriver.safeToSkipEmit(sourceFile)
) {
this.requiredFilesToEmit.add(sourceFile.fileName);
this.requiredFilesToEmit.add(normalizePath(sourceFile.fileName));
}
}

Expand All @@ -507,7 +507,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 @@ -596,11 +596,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 @@ -627,7 +628,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 c6e65e4

Please sign in to comment.