Skip to content

Commit

Permalink
fix(@ngtools/webpack): use a single module resolution cache
Browse files Browse the repository at this point in the history
  • Loading branch information
alan-agius4 authored and vikerman committed Jul 26, 2019
1 parent 8b1c1f5 commit f2ee4f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/ngtools/webpack/src/angular_compiler_plugin.ts
Expand Up @@ -355,8 +355,6 @@ export class AngularCompilerPlugin {
this._updateForkedTypeChecker(this._rootNames, this._getChangedCompilationFiles());
}

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

if (this._JitMode) {
Expand Down Expand Up @@ -675,6 +673,9 @@ export class AngularCompilerPlugin {
);
}

// Use an identity function as all our paths are absolute already.
this._moduleResolutionCache = ts.createModuleResolutionCache(this._basePath, x => x);

// Create the webpack compiler host.
const webpackCompilerHost = new WebpackCompilerHost(
this._compilerOptions,
Expand All @@ -683,6 +684,7 @@ export class AngularCompilerPlugin {
true,
this._options.directTemplateLoading,
ngccProcessor,
this._moduleResolutionCache,
);

// Create and set a new WebpackResourceLoader in AOT
Expand Down
2 changes: 2 additions & 0 deletions packages/ngtools/webpack/src/compiler_host.ts
Expand Up @@ -46,6 +46,7 @@ export class WebpackCompilerHost implements ts.CompilerHost {
private readonly cacheSourceFiles: boolean,
private readonly directTemplateLoading = false,
private readonly ngccProcessor?: NgccProcessor,
private readonly moduleResolutionCache?: ts.ModuleResolutionCache,
) {
this._syncHost = new virtualFs.SyncDelegateHost(host);
this._memoryHost = new virtualFs.SyncDelegateHost(new virtualFs.SimpleMemoryHost());
Expand Down Expand Up @@ -405,6 +406,7 @@ export class WebpackCompilerHost implements ts.CompilerHost {
workaroundResolve(containingFile),
this._options,
this,
this.moduleResolutionCache,
);

if (this._options.enableIvy && resolvedModule && this.ngccProcessor) {
Expand Down

0 comments on commit f2ee4f6

Please sign in to comment.