Skip to content

Commit 2e8c8b8

Browse files
committedJun 28, 2024
only non production
1 parent 5100a3a commit 2e8c8b8

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed
 

‎src/plugin.ts

+15-5
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ function insertCompiledTemplate<EnvSpecificOptions>(
497497

498498
let expression = t.callExpression(templateFactoryIdentifier, [templateExpression]);
499499

500+
let params = [];
500501
let assignment = target.parent;
501502
let rootName = basename(state.filename).slice(0, -extname(state.filename).length);
502503
let assignmentName: t.StringLiteral | t.Identifier = t.identifier('undefined');
@@ -510,14 +511,18 @@ function insertCompiledTemplate<EnvSpecificOptions>(
510511
assignmentName = t.stringLiteral(rootName);
511512
}
512513

514+
if (process.env.EMBER_ENV !== 'production') {
515+
params.push(t.identifier('undefined'), assignmentName);
516+
}
517+
513518
if (config.rfc931Support) {
514519
expression = t.callExpression(i.import('@ember/component', 'setComponentTemplate'), [
515520
expression,
516521
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+
),
521526
]);
522527
}
523528
return expression;
@@ -621,6 +626,7 @@ function updateCallForm<EnvSpecificOptions>(
621626
removeEvalAndScope(target);
622627
target.node.arguments = target.node.arguments.slice(0, 2);
623628

629+
let params: (Babel.types.Identifier | Babel.types.StringLiteral)[] = [];
624630
let assignment = target.parent;
625631
let rootName = basename(state.filename).slice(0, -extname(state.filename).length);
626632
let assignmentName: Babel.types.Identifier | Babel.types.StringLiteral =
@@ -636,14 +642,18 @@ function updateCallForm<EnvSpecificOptions>(
636642
assignmentName = babel.types.stringLiteral(name);
637643
}
638644

645+
if (process.env.EMBER_ENV !== 'production') {
646+
params.push(babel.types.identifier('undefined'), assignmentName);
647+
}
648+
639649
state.recursionGuard.add(target.node);
640650
state.util.replaceWith(target, (i) =>
641651
babel.types.callExpression(i.import('@ember/component', 'setComponentTemplate'), [
642652
target.node,
643653
backingClass?.node ??
644654
babel.types.callExpression(
645655
i.import('@ember/component/template-only', 'default', 'templateOnly'),
646-
[babel.types.identifier('undefined'), assignmentName]
656+
params
647657
),
648658
])
649659
);

0 commit comments

Comments
 (0)