Skip to content

Commit 0f0a1f2

Browse files
crisbetodylhunn
authored andcommitted
fix(compiler-cli): emitting references to ngtypecheck files (#57138)
Follow-up to #56961 which doesn't appear to have caught all the cases. This change moves the pre-emit untagging to `NgCompiler.prepareEmit` which seems to cover a bit more comared to `NgtscProgram.emit`. Fixes #57135. PR Close #57138
1 parent ca89ef9 commit 0f0a1f2

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

packages/compiler-cli/src/ngtsc/core/src/compiler.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ import {DiagnosticCategoryLabel, NgCompilerAdapter, NgCompilerOptions} from '../
125125
import {coreHasSymbol} from './core_version';
126126
import {coreVersionSupportsFeature} from './feature_detection';
127127
import {angularJitApplicationTransform} from '../../transform/jit';
128+
import {untagAllTsFiles} from '../../shims';
128129

129130
/**
130131
* State information about a compilation which is only generated once some data is requested from
@@ -793,6 +794,10 @@ export class NgCompiler {
793794
} {
794795
const compilation = this.ensureAnalyzed();
795796

797+
// Untag all the files, otherwise TS 5.4 may end up emitting
798+
// references to typecheck files (see #56945 and #57135).
799+
untagAllTsFiles(this.inputProgram);
800+
796801
const coreImportsFrom = compilation.isCore ? getR3SymbolsFile(this.inputProgram) : null;
797802
let importRewriter: ImportRewriter;
798803
if (coreImportsFrom !== null) {

packages/compiler-cli/src/ngtsc/program.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import {IndexedComponent} from './indexer';
2828
import {ActivePerfRecorder, PerfCheckpoint as PerfCheckpoint, PerfEvent, PerfPhase} from './perf';
2929
import {TsCreateProgramDriver} from './program_driver';
3030
import {DeclarationNode} from './reflection';
31-
import {retagAllTsFiles, untagAllTsFiles} from './shims';
31+
import {retagAllTsFiles} from './shims';
3232
import {OptimizeFor} from './typecheck/api';
3333

3434
/**
@@ -293,10 +293,6 @@ export class NgtscProgram implements api.Program {
293293
}
294294
}
295295

296-
// Untag all the files, otherwise TS 5.4 may end up emitting
297-
// references to typecheck files (see #56945).
298-
untagAllTsFiles(this.tsProgram);
299-
300296
const forceEmit = opts?.forceEmit ?? false;
301297

302298
this.compiler.perfRecorder.memory(PerfCheckpoint.PreEmit);

0 commit comments

Comments
 (0)