Skip to content

Commit

Permalink
fix(@ngtools/webpack): fix for TypeScript module resolution cache mis…
Browse files Browse the repository at this point in the history
…sing in old version
  • Loading branch information
hansl committed Oct 12, 2017
1 parent e42b161 commit e83dd93
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/@ngtools/webpack/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class AotPlugin implements Tapable {
private _compilerOptions: ts.CompilerOptions;
private _angularCompilerOptions: any;
private _program: ts.Program;
private _moduleResolutionCache: ts.ModuleResolutionCache;
private _moduleResolutionCache?: ts.ModuleResolutionCache;
private _rootFilePath: string[];
private _compilerHost: WebpackCompilerHost;
private _resourceLoader: WebpackResourceLoader;
Expand Down Expand Up @@ -225,9 +225,11 @@ export class AotPlugin implements Tapable {
this._program = ts.createProgram(
this._rootFilePath, this._compilerOptions, this._compilerHost);

// We use absolute paths everywhere.
this._moduleResolutionCache = ts.createModuleResolutionCache(
this._basePath, (fileName: string) => fileName);
if (ts.createModuleResolutionCache) {
// We use absolute paths everywhere.
this._moduleResolutionCache = ts.createModuleResolutionCache(
this._basePath, (fileName: string) => fileName);
}

// We enable caching of the filesystem in compilerHost _after_ the program has been created,
// because we don't want SourceFile instances to be cached past this point.
Expand Down

0 comments on commit e83dd93

Please sign in to comment.