From e483a50504409756c59e2f53e052460e9d8e3d05 Mon Sep 17 00:00:00 2001 From: Filipe Silva Date: Thu, 17 Oct 2019 16:01:24 +0100 Subject: [PATCH] fix(@ngtools/webpack): don't set ngprogram to null It should be undefined instead: https://github.com/angular/angular/blob/cd7b1992193be85f3317a4ef793b13c03ac2b215/packages/compiler-cli/src/ngtsc/program.ts#L161 Fix https://github.com/angular/angular-cli/issues/15857 --- src/angular_compiler_plugin.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/angular_compiler_plugin.ts b/src/angular_compiler_plugin.ts index a7f0ad7a8c17..5622c50bb1b9 100644 --- a/src/angular_compiler_plugin.ts +++ b/src/angular_compiler_plugin.ts @@ -91,7 +91,7 @@ export class AngularCompilerPlugin { // TS compilation. private _compilerOptions: CompilerOptions; private _rootNames: string[]; - private _program: (ts.Program | Program) | null; + private _program: (ts.Program | Program) | undefined; private _compilerHost: WebpackCompilerHost & CompilerHost; private _moduleResolutionCache: ts.ModuleResolutionCache; private _resourceLoader?: WebpackResourceLoader; @@ -673,7 +673,7 @@ export class AngularCompilerPlugin { // only present for webpack 4.23.0+, assume true otherwise const watchMode = rootCompiler.watchMode === undefined ? true : rootCompiler.watchMode; if (!watchMode) { - this._program = null; + this._program = undefined; this._transformers = []; this._resourceLoader = undefined; this._compilerHost.reset(); @@ -1385,7 +1385,7 @@ export class AngularCompilerPlugin { } else { errMsg = e.stack; // It is not a syntax error we might have a program with unknown state, discard it. - this._program = null; + this._program = undefined; code = UNKNOWN_ERROR_CODE; } allDiagnostics.push(