@@ -67,13 +67,6 @@ import type {
67
67
import type { APIVersion } from '@lwc/shared' ;
68
68
import type { Node } from 'estree' ;
69
69
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
-
77
70
type RenderPrimitive =
78
71
| 'iterator'
79
72
| 'flatten'
@@ -649,7 +642,7 @@ export default class CodeGen {
649
642
if ( this . state . config . experimentalComplexExpressions ) {
650
643
// Cloning here is necessary because `this.replace()` is destructive, and we might use the
651
644
// node later during static content optimization
652
- expression = doStructuredClone ( expression ) ;
645
+ expression = structuredClone ( expression ) ;
653
646
return bindComplexExpression ( expression as ComplexExpression , this ) ;
654
647
}
655
648
@@ -659,7 +652,7 @@ export default class CodeGen {
659
652
660
653
// Cloning here is necessary because `this.replace()` is destructive, and we might use the
661
654
// node later during static content optimization
662
- expression = doStructuredClone ( expression ) ;
655
+ expression = structuredClone ( expression ) ;
663
656
// TODO [#3370]: when the template expression flag is removed, the
664
657
// ComplexExpression type should be redefined as an ESTree Node. Doing
665
658
// so when the flag is still in place results in a cascade of required
0 commit comments