@@ -58,7 +58,12 @@ export const transformElement: NodeTransform = (node, context) => {
5858 )
5959 return
6060
61- const isComponent = node . tagType === ElementTypes . COMPONENT
61+ // treat custom elements as components because the template helper cannot
62+ // resolve them properly; they require creation via createElement
63+ const isCustomElement = ! ! context . options . isCustomElement ( node . tag )
64+ const isComponent =
65+ node . tagType === ElementTypes . COMPONENT || isCustomElement
66+
6267 const isDynamicComponent = isComponentTag ( node . tag )
6368 const propsResult = buildProps (
6469 node ,
@@ -78,9 +83,10 @@ export const transformElement: NodeTransform = (node, context) => {
7883 parent = parent . parent
7984 }
8085 const singleRoot =
81- context . root === parent &&
82- parent . node . children . filter ( child => child . type !== NodeTypes . COMMENT )
83- . length === 1
86+ ( context . root === parent &&
87+ parent . node . children . filter ( child => child . type !== NodeTypes . COMMENT )
88+ . length === 1 ) ||
89+ isCustomElement
8490
8591 if ( isComponent ) {
8692 transformComponentElement (
@@ -89,6 +95,7 @@ export const transformElement: NodeTransform = (node, context) => {
8995 singleRoot ,
9096 context ,
9197 isDynamicComponent ,
98+ isCustomElement ,
9299 )
93100 } else {
94101 transformNativeElement (
@@ -108,6 +115,7 @@ function transformComponentElement(
108115 singleRoot : boolean ,
109116 context : TransformContext ,
110117 isDynamicComponent : boolean ,
118+ isCustomElement : boolean ,
111119) {
112120 const dynamicComponent = isDynamicComponent
113121 ? resolveDynamicComponent ( node )
@@ -116,7 +124,7 @@ function transformComponentElement(
116124 let { tag } = node
117125 let asset = true
118126
119- if ( ! dynamicComponent ) {
127+ if ( ! dynamicComponent && ! isCustomElement ) {
120128 const fromSetup = resolveSetupReference ( tag , context )
121129 if ( fromSetup ) {
122130 tag = fromSetup
@@ -161,6 +169,7 @@ function transformComponentElement(
161169 slots : [ ...context . slots ] ,
162170 once : context . inVOnce ,
163171 dynamic : dynamicComponent ,
172+ isCustomElement,
164173 }
165174 context . slots = [ ]
166175}
0 commit comments