Skip to content

Commit e83dd93

Browse files
committed
fix(@ngtools/webpack): fix for TypeScript module resolution cache missing in old version
1 parent e42b161 commit e83dd93

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export class AotPlugin implements Tapable {
5050
private _compilerOptions: ts.CompilerOptions;
5151
private _angularCompilerOptions: any;
5252
private _program: ts.Program;
53-
private _moduleResolutionCache: ts.ModuleResolutionCache;
53+
private _moduleResolutionCache?: ts.ModuleResolutionCache;
5454
private _rootFilePath: string[];
5555
private _compilerHost: WebpackCompilerHost;
5656
private _resourceLoader: WebpackResourceLoader;
@@ -225,9 +225,11 @@ export class AotPlugin implements Tapable {
225225
this._program = ts.createProgram(
226226
this._rootFilePath, this._compilerOptions, this._compilerHost);
227227

228-
// We use absolute paths everywhere.
229-
this._moduleResolutionCache = ts.createModuleResolutionCache(
230-
this._basePath, (fileName: string) => fileName);
228+
if (ts.createModuleResolutionCache) {
229+
// We use absolute paths everywhere.
230+
this._moduleResolutionCache = ts.createModuleResolutionCache(
231+
this._basePath, (fileName: string) => fileName);
232+
}
231233

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

0 commit comments

Comments
 (0)