@@ -497,6 +497,7 @@ function insertCompiledTemplate<EnvSpecificOptions>(
497
497
498
498
let expression = t . callExpression ( templateFactoryIdentifier , [ templateExpression ] ) ;
499
499
500
+ let params = [ ] ;
500
501
let assignment = target . parent ;
501
502
let rootName = basename ( state . filename ) . slice ( 0 , - extname ( state . filename ) . length ) ;
502
503
let assignmentName : t . StringLiteral | t . Identifier = t . identifier ( 'undefined' ) ;
@@ -510,14 +511,18 @@ function insertCompiledTemplate<EnvSpecificOptions>(
510
511
assignmentName = t . stringLiteral ( rootName ) ;
511
512
}
512
513
514
+ if ( process . env . EMBER_ENV !== 'production' ) {
515
+ params . push ( t . identifier ( 'undefined' ) , assignmentName ) ;
516
+ }
517
+
513
518
if ( config . rfc931Support ) {
514
519
expression = t . callExpression ( i . import ( '@ember/component' , 'setComponentTemplate' ) , [
515
520
expression ,
516
521
backingClass ?. node ??
517
- t . callExpression ( i . import ( '@ember/component/template-only' , 'default' , 'templateOnly' ) , [
518
- t . identifier ( 'undefined ') ,
519
- assignmentName ,
520
- ] ) ,
522
+ t . callExpression (
523
+ i . import ( '@ember/component/template-only' , 'default' , 'templateOnly ') ,
524
+ params
525
+ ) ,
521
526
] ) ;
522
527
}
523
528
return expression ;
@@ -621,6 +626,7 @@ function updateCallForm<EnvSpecificOptions>(
621
626
removeEvalAndScope ( target ) ;
622
627
target . node . arguments = target . node . arguments . slice ( 0 , 2 ) ;
623
628
629
+ let params : ( Babel . types . Identifier | Babel . types . StringLiteral ) [ ] = [ ] ;
624
630
let assignment = target . parent ;
625
631
let rootName = basename ( state . filename ) . slice ( 0 , - extname ( state . filename ) . length ) ;
626
632
let assignmentName : Babel . types . Identifier | Babel . types . StringLiteral =
@@ -636,14 +642,18 @@ function updateCallForm<EnvSpecificOptions>(
636
642
assignmentName = babel . types . stringLiteral ( name ) ;
637
643
}
638
644
645
+ if ( process . env . EMBER_ENV !== 'production' ) {
646
+ params . push ( babel . types . identifier ( 'undefined' ) , assignmentName ) ;
647
+ }
648
+
639
649
state . recursionGuard . add ( target . node ) ;
640
650
state . util . replaceWith ( target , ( i ) =>
641
651
babel . types . callExpression ( i . import ( '@ember/component' , 'setComponentTemplate' ) , [
642
652
target . node ,
643
653
backingClass ?. node ??
644
654
babel . types . callExpression (
645
655
i . import ( '@ember/component/template-only' , 'default' , 'templateOnly' ) ,
646
- [ babel . types . identifier ( 'undefined' ) , assignmentName ]
656
+ params
647
657
) ,
648
658
] )
649
659
) ;
0 commit comments