diff --git a/packages/language-core/lib/codegen/template/element.ts b/packages/language-core/lib/codegen/template/element.ts index ec9c86def8..9fdf951cd9 100644 --- a/packages/language-core/lib/codegen/template/element.ts +++ b/packages/language-core/lib/codegen/template/element.ts @@ -602,7 +602,7 @@ function* generateReferencesForElements( ); yield ` } */${endOfLine}`; - if (variableNameRegex.test(content)) { + if (variableNameRegex.test(content) && !options.templateRefNames.has(content)) { ctx.accessExternalVariable(content, startOffset); }