@@ -67,13 +67,6 @@ import type {
6767import type { APIVersion } from '@lwc/shared' ;
6868import type { Node } from 'estree' ;
6969
70- // structuredClone is only available in Node 17+
71- // https://developer.mozilla.org/en-US/docs/Web/API/structuredClone#browser_compatibility
72- const doStructuredClone =
73- typeof structuredClone === 'function'
74- ? structuredClone
75- : ( obj : any ) => JSON . parse ( JSON . stringify ( obj ) ) ;
76-
7770type RenderPrimitive =
7871 | 'iterator'
7972 | 'flatten'
@@ -649,7 +642,7 @@ export default class CodeGen {
649642 if ( this . state . config . experimentalComplexExpressions ) {
650643 // Cloning here is necessary because `this.replace()` is destructive, and we might use the
651644 // node later during static content optimization
652- expression = doStructuredClone ( expression ) ;
645+ expression = structuredClone ( expression ) ;
653646 return bindComplexExpression ( expression as ComplexExpression , this ) ;
654647 }
655648
@@ -659,7 +652,7 @@ export default class CodeGen {
659652
660653 // Cloning here is necessary because `this.replace()` is destructive, and we might use the
661654 // node later during static content optimization
662- expression = doStructuredClone ( expression ) ;
655+ expression = structuredClone ( expression ) ;
663656 // TODO [#3370]: when the template expression flag is removed, the
664657 // ComplexExpression type should be redefined as an ESTree Node. Doing
665658 // so when the flag is still in place results in a cascade of required
0 commit comments