11import {
22 type ComponentInternalInstance ,
3+ type ComponentInternalOptions ,
34 type ComponentOptions ,
45 type ConcreteComponent ,
56 currentInstance ,
67 getComponentName ,
78} from '../component'
89import { currentRenderingInstance } from '../componentRenderContext'
910import type { Directive } from '../directives'
10- import { camelize , capitalize , isString } from '@vue/shared'
11+ import { camelize , capitalize , isLateTag , isString } from '@vue/shared'
1112import { warn } from '../warning'
1213import type { VNodeTypes } from '../vnode'
1314
@@ -118,12 +119,21 @@ function resolveAsset(
118119 return Component
119120 }
120121
121- if ( __DEV__ && warnMissing && ! res ) {
122- const extra =
123- type === COMPONENTS
124- ? `\nIf this is a native custom element, make sure to exclude it from ` +
122+ if (
123+ __DEV__ &&
124+ warnMissing &&
125+ ( ( ! res && ! isLateTag ( name ) ) || ( res && isLateTag ( name ) ) )
126+ ) {
127+ let extra = ''
128+ if ( type === COMPONENTS ) {
129+ if ( isLateTag ( name ) ) {
130+ extra = `\nplease do not use built-in tag names as component names.`
131+ } else {
132+ extra =
133+ `\nIf this is a native custom element, make sure to exclude it from ` +
125134 `component resolution via compilerOptions.isCustomElement.`
126- : ``
135+ }
136+ }
127137 warn ( `Failed to resolve ${ type . slice ( 0 , - 1 ) } : ${ name } ${ extra } ` )
128138 }
129139
@@ -144,3 +154,23 @@ function resolve(registry: Record<string, any> | undefined, name: string) {
144154 registry [ capitalize ( camelize ( name ) ) ] )
145155 )
146156}
157+
158+ /**
159+ * @private
160+ */
161+ export function resolveSetupReturned (
162+ name : string ,
163+ setupReturn : ComponentInternalInstance [ 'setupState' ] ,
164+ ) : unknown {
165+ if ( ! setupReturn ) return name
166+ const returnValue = setupReturn [ name ]
167+ if (
168+ returnValue &&
169+ ( returnValue as ComponentInternalOptions ) . __file &&
170+ isLateTag ( name as string )
171+ ) {
172+ const extra = `\nplease do not use built-in tag names as component names.`
173+ warn ( `Failed to resolve component: ${ name } ,${ extra } ` )
174+ }
175+ return returnValue
176+ }
0 commit comments