Skip to content

Commit 22ae695

Browse files
filipesilvahansl
authored andcommitted
fix(@ngtools/webpack): fix rebuild speed regression
See #7995 (comment) for details. Fix regression introduced in #7998
1 parent 56c3e26 commit 22ae695

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

packages/@ngtools/webpack/src/loader.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,6 @@ export function ngcLoader(this: LoaderContext & { _compilation: any }, source: s
568568
.then(() => {
569569
timeEnd(timeLabel + '.ngcLoader.AngularCompilerPlugin');
570570
const result = plugin.getFile(sourceFileName);
571-
const dependencies = plugin.getDependencies(sourceFileName);
572571

573572
if (result.sourceMap) {
574573
// Process sourcemaps for Webpack.
@@ -585,7 +584,10 @@ export function ngcLoader(this: LoaderContext & { _compilation: any }, source: s
585584
throw new Error('TypeScript compilation failed.');
586585
}
587586

588-
dependencies.forEach(dep => this.addDependency(dep));
587+
// Dependencies must use system path separator.
588+
const dependencies = plugin.getDependencies(sourceFileName);
589+
dependencies.forEach(dep => this.addDependency(dep.replace(/\//g, path.sep)));
590+
589591
cb(null, result.outputText, result.sourceMap);
590592
})
591593
.catch(err => {
@@ -646,8 +648,9 @@ export function ngcLoader(this: LoaderContext & { _compilation: any }, source: s
646648
_getResourcesUrls(refactor).forEach((url: string) => {
647649
this.addDependency(path.resolve(path.dirname(sourceFileName), url));
648650
});
651+
// Dependencies must use system path separator.
649652
_getImports(refactor, compilerOptions, plugin.compilerHost, plugin.moduleResolutionCache)
650-
.forEach((importString: string) => this.addDependency(importString));
653+
.forEach((dep) => this.addDependency(dep.replace(/\//g, path.sep)));
651654
timeEnd(timeLabel + '.ngcLoader.AotPlugin.addDependency');
652655
})
653656
.then(() => {

0 commit comments

Comments
 (0)