@@ -66,13 +66,6 @@ import type {
6666import type { APIVersion } from '@lwc/shared' ;
6767import type { Node } from 'estree' ;
6868
69- // structuredClone is only available in Node 17+
70- // https://developer.mozilla.org/en-US/docs/Web/API/structuredClone#browser_compatibility
71- const doStructuredClone =
72- typeof structuredClone === 'function'
73- ? structuredClone
74- : ( obj : any ) => JSON . parse ( JSON . stringify ( obj ) ) ;
75-
7669type RenderPrimitive =
7770 | 'iterator'
7871 | 'flatten'
@@ -629,7 +622,7 @@ export default class CodeGen {
629622 if ( this . state . config . experimentalComplexExpressions ) {
630623 // Cloning here is necessary because `this.replace()` is destructive, and we might use the
631624 // node later during static content optimization
632- expression = doStructuredClone ( expression ) ;
625+ expression = structuredClone ( expression ) ;
633626 return bindComplexExpression ( expression as ComplexExpression , this ) ;
634627 }
635628
@@ -639,7 +632,7 @@ export default class CodeGen {
639632
640633 // Cloning here is necessary because `this.replace()` is destructive, and we might use the
641634 // node later during static content optimization
642- expression = doStructuredClone ( expression ) ;
635+ expression = structuredClone ( expression ) ;
643636 // TODO [#3370]: when the template expression flag is removed, the
644637 // ComplexExpression type should be redefined as an ESTree Node. Doing
645638 // so when the flag is still in place results in a cascade of required
0 commit comments