Skip to content

Commit 9c19ca4

Browse files
clydinalan-agius4
authored andcommitted
fix(@ngtools/webpack): normalize paths when pruning AOT rebuild requests
1 parent eeec921 commit 9c19ca4

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ export class AngularWebpackPlugin {
485485
!ignoreForEmit.has(sourceFile) &&
486486
!angularCompiler.incrementalDriver.safeToSkipEmit(sourceFile)
487487
) {
488-
this.requiredFilesToEmit.add(sourceFile.fileName);
488+
this.requiredFilesToEmit.add(normalizePath(sourceFile.fileName));
489489
}
490490
}
491491

@@ -500,7 +500,7 @@ export class AngularWebpackPlugin {
500500
mergeTransformers(angularCompiler.prepareEmit().transformers, transformers),
501501
getDependencies,
502502
(sourceFile) => {
503-
this.requiredFilesToEmit.delete(sourceFile.fileName);
503+
this.requiredFilesToEmit.delete(normalizePath(sourceFile.fileName));
504504
angularCompiler.incrementalDriver.recordSuccessfulEmit(sourceFile);
505505
},
506506
);
@@ -589,11 +589,12 @@ export class AngularWebpackPlugin {
589589
onAfterEmit?: (sourceFile: ts.SourceFile) => void,
590590
): FileEmitter {
591591
return async (file: string) => {
592-
if (this.requiredFilesToEmitCache.has(file)) {
593-
return this.requiredFilesToEmitCache.get(file);
592+
const filePath = normalizePath(file);
593+
if (this.requiredFilesToEmitCache.has(filePath)) {
594+
return this.requiredFilesToEmitCache.get(filePath);
594595
}
595596

596-
const sourceFile = program.getSourceFile(file);
597+
const sourceFile = program.getSourceFile(filePath);
597598
if (!sourceFile) {
598599
return undefined;
599600
}
@@ -620,7 +621,7 @@ export class AngularWebpackPlugin {
620621
if (content !== undefined && this.watchMode) {
621622
// Capture emit history info for Angular rebuild analysis
622623
hash = hashContent(content);
623-
this.fileEmitHistory.set(file, { length: content.length, hash });
624+
this.fileEmitHistory.set(filePath, { length: content.length, hash });
624625
}
625626

626627
const dependencies = [

0 commit comments

Comments
 (0)