Skip to content

Commit f2ee4f6

Browse files
alan-agius4vikerman
authored andcommitted
fix(@ngtools/webpack): use a single module resolution cache
1 parent 8b1c1f5 commit f2ee4f6

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

packages/ngtools/webpack/src/angular_compiler_plugin.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,6 @@ export class AngularCompilerPlugin {
355355
this._updateForkedTypeChecker(this._rootNames, this._getChangedCompilationFiles());
356356
}
357357

358-
// Use an identity function as all our paths are absolute already.
359-
this._moduleResolutionCache = ts.createModuleResolutionCache(this._basePath, x => x);
360358
const oldTsProgram = this._getTsProgram();
361359

362360
if (this._JitMode) {
@@ -675,6 +673,9 @@ export class AngularCompilerPlugin {
675673
);
676674
}
677675

676+
// Use an identity function as all our paths are absolute already.
677+
this._moduleResolutionCache = ts.createModuleResolutionCache(this._basePath, x => x);
678+
678679
// Create the webpack compiler host.
679680
const webpackCompilerHost = new WebpackCompilerHost(
680681
this._compilerOptions,
@@ -683,6 +684,7 @@ export class AngularCompilerPlugin {
683684
true,
684685
this._options.directTemplateLoading,
685686
ngccProcessor,
687+
this._moduleResolutionCache,
686688
);
687689

688690
// Create and set a new WebpackResourceLoader in AOT

packages/ngtools/webpack/src/compiler_host.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ export class WebpackCompilerHost implements ts.CompilerHost {
4646
private readonly cacheSourceFiles: boolean,
4747
private readonly directTemplateLoading = false,
4848
private readonly ngccProcessor?: NgccProcessor,
49+
private readonly moduleResolutionCache?: ts.ModuleResolutionCache,
4950
) {
5051
this._syncHost = new virtualFs.SyncDelegateHost(host);
5152
this._memoryHost = new virtualFs.SyncDelegateHost(new virtualFs.SimpleMemoryHost());
@@ -405,6 +406,7 @@ export class WebpackCompilerHost implements ts.CompilerHost {
405406
workaroundResolve(containingFile),
406407
this._options,
407408
this,
409+
this.moduleResolutionCache,
408410
);
409411

410412
if (this._options.enableIvy && resolvedModule && this.ngccProcessor) {

0 commit comments

Comments
 (0)