Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(@ngtools/webpack): normalize paths when pruning AOT rebuild requests #20078

Merged
merged 1 commit into from Feb 18, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 7 additions & 6 deletions packages/ngtools/webpack/src/ivy/plugin.ts
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