diff --git a/packages/compiler-cli/src/transformers/program.ts b/packages/compiler-cli/src/transformers/program.ts index 4461fc9fae..55bf7bee57 100644 --- a/packages/compiler-cli/src/transformers/program.ts +++ b/packages/compiler-cli/src/transformers/program.ts @@ -227,9 +227,10 @@ class AngularCompilerProgram implements Program { let emitResult: ts.EmitResult; let emittedUserTsCount: number; try { - const emitChangedFilesOnly = this._changedNonGenFileNames && - this._changedNonGenFileNames.length < MAX_FILE_COUNT_FOR_SINGLE_FILE_EMIT; - if (emitChangedFilesOnly) { + const useSingleFileEmit = this._changedNonGenFileNames && + (this._changedNonGenFileNames.length + genTsFiles.length) < + MAX_FILE_COUNT_FOR_SINGLE_FILE_EMIT; + if (useSingleFileEmit) { const fileNamesToEmit = [...this._changedNonGenFileNames !, ...genTsFiles.map(gf => gf.genFileUrl)]; emitResult = mergeEmitResults(