From d97994b27f1cf2a2eebb87bcfce4a83330e8cf06 Mon Sep 17 00:00:00 2001 From: Alex Rickabaugh Date: Fri, 9 Nov 2018 20:31:05 +0100 Subject: [PATCH] fix(ivy): clone ts.SourceFile in ivy_switch when triggered (#27032) Make a copy of the ts.SourceFile before modifying it in the ivy_switch transform. It's suspected that the Bazel tsc_wrapped host's SourceFile cache has issues when the ts.SourceFiles are mutated. PR Close #27032 --- packages/compiler-cli/src/ngtsc/switch/src/switch.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/compiler-cli/src/ngtsc/switch/src/switch.ts b/packages/compiler-cli/src/ngtsc/switch/src/switch.ts index 8c1dfe3e81..5b8c1507d3 100644 --- a/packages/compiler-cli/src/ngtsc/switch/src/switch.ts +++ b/packages/compiler-cli/src/ngtsc/switch/src/switch.ts @@ -42,6 +42,7 @@ function flipIvySwitchInFile(sf: ts.SourceFile): ts.SourceFile { // Only update the statements in the SourceFile if any have changed. if (newStatements !== undefined) { + sf = ts.getMutableClone(sf); sf.statements = ts.createNodeArray(newStatements); } return sf;