fix(component): prioritize registered component over implicit self-reference via filename
ref: #2827
This commit is contained in:
@@ -66,6 +66,7 @@ return function render(_ctx, _cache) {
|
||||
const _component_Foo = _resolveComponent(\\"Foo\\")
|
||||
const _component_bar_baz = _resolveComponent(\\"bar-baz\\")
|
||||
const _component_barbaz = _resolveComponent(\\"barbaz\\")
|
||||
const _component_Qux = _resolveComponent(\\"Qux\\", true)
|
||||
const _directive_my_dir_0 = _resolveDirective(\\"my_dir_0\\")
|
||||
const _directive_my_dir_1 = _resolveDirective(\\"my_dir_1\\")
|
||||
let _temp0, _temp1, _temp2
|
||||
|
||||
@@ -126,7 +126,7 @@ describe('compiler: codegen', () => {
|
||||
|
||||
test('assets + temps', () => {
|
||||
const root = createRoot({
|
||||
components: [`Foo`, `bar-baz`, `barbaz`],
|
||||
components: [`Foo`, `bar-baz`, `barbaz`, `Qux__self`],
|
||||
directives: [`my_dir_0`, `my_dir_1`],
|
||||
temps: 3
|
||||
})
|
||||
@@ -144,6 +144,12 @@ describe('compiler: codegen', () => {
|
||||
helperNameMap[RESOLVE_COMPONENT]
|
||||
}("barbaz")\n`
|
||||
)
|
||||
// implicit self reference from SFC filename
|
||||
expect(code).toMatch(
|
||||
`const _component_Qux = _${
|
||||
helperNameMap[RESOLVE_COMPONENT]
|
||||
}("Qux", true)\n`
|
||||
)
|
||||
expect(code).toMatch(
|
||||
`const _directive_my_dir_0 = _${
|
||||
helperNameMap[RESOLVE_DIRECTIVE]
|
||||
|
||||
@@ -75,7 +75,7 @@ describe('compiler: element transform', () => {
|
||||
filename: `/foo/bar/Example.vue?vue&type=template`
|
||||
})
|
||||
expect(root.helpers).toContain(RESOLVE_COMPONENT)
|
||||
expect(root.components).toContain(`_self`)
|
||||
expect(root.components).toContain(`Example__self`)
|
||||
})
|
||||
|
||||
test('static props', () => {
|
||||
|
||||
Reference in New Issue
Block a user