From 3e462ad6e77e96919c1a4bbe25d932835875c7c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=B1=E5=90=B9=E8=89=B2=E5=BE=A1=E5=AE=88?= <85992002+KazariEX@users.noreply.github.com> Date: Sat, 7 Dec 2024 01:39:43 +0800 Subject: [PATCH] fix(language-core): don't generate variable access of template refs using `useTemplateRef` (#5032) --- packages/language-core/lib/codegen/template/element.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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); }