Skip to content

Commit a7e820a

Browse files
authored
fix(language-core): exclude effect of comments on root node (#5689)
1 parent 49aa565 commit a7e820a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/language-core/lib/codegen/template/templateChild.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ function* collectSingleRootNodes(
129129
options: TemplateCodegenOptions,
130130
children: CompilerDOM.TemplateChildNode[],
131131
): Generator<CompilerDOM.ElementNode | null> {
132+
// Exclude the effect of comments on the root node
133+
children = children.filter(node => node.type !== CompilerDOM.NodeTypes.COMMENT);
134+
132135
if (children.length !== 1) {
133136
// "null" is used to determine whether the component is not always has a single root
134137
if (children.length > 1) {

0 commit comments

Comments
 (0)