Skip to content

Commit c6e65e4

Browse files
clydinfilipesilva
authored andcommitted
fix(@ngtools/webpack): normalize paths when pruning AOT rebuild requests
1 parent 789e05d commit c6e65e4

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

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

+7-6
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ export class AngularWebpackPlugin {
492492
!ignoreForEmit.has(sourceFile) &&
493493
!angularCompiler.incrementalDriver.safeToSkipEmit(sourceFile)
494494
) {
495-
this.requiredFilesToEmit.add(sourceFile.fileName);
495+
this.requiredFilesToEmit.add(normalizePath(sourceFile.fileName));
496496
}
497497
}
498498

@@ -507,7 +507,7 @@ export class AngularWebpackPlugin {
507507
mergeTransformers(angularCompiler.prepareEmit().transformers, transformers),
508508
getDependencies,
509509
(sourceFile) => {
510-
this.requiredFilesToEmit.delete(sourceFile.fileName);
510+
this.requiredFilesToEmit.delete(normalizePath(sourceFile.fileName));
511511
angularCompiler.incrementalDriver.recordSuccessfulEmit(sourceFile);
512512
},
513513
);
@@ -596,11 +596,12 @@ export class AngularWebpackPlugin {
596596
onAfterEmit?: (sourceFile: ts.SourceFile) => void,
597597
): FileEmitter {
598598
return async (file: string) => {
599-
if (this.requiredFilesToEmitCache.has(file)) {
600-
return this.requiredFilesToEmitCache.get(file);
599+
const filePath = normalizePath(file);
600+
if (this.requiredFilesToEmitCache.has(filePath)) {
601+
return this.requiredFilesToEmitCache.get(filePath);
601602
}
602603

603-
const sourceFile = program.getSourceFile(file);
604+
const sourceFile = program.getSourceFile(filePath);
604605
if (!sourceFile) {
605606
return undefined;
606607
}
@@ -627,7 +628,7 @@ export class AngularWebpackPlugin {
627628
if (content !== undefined && this.watchMode) {
628629
// Capture emit history info for Angular rebuild analysis
629630
hash = hashContent(content);
630-
this.fileEmitHistory.set(file, { length: content.length, hash });
631+
this.fileEmitHistory.set(filePath, { length: content.length, hash });
631632
}
632633

633634
const dependencies = [

0 commit comments

Comments
 (0)