Subscribe on changes!

[Vue warn]: Failed to resolve component: _self

avatar
Apr 9th 2021

Version

3.0.11

Reproduction link

https://codepen.io/pen

Steps to reproduce

Components call themselves recursively

What is expected?

开发环境能够不出现提示信息

What is actually happening?

3.0.5 版本一切正常,3.0.11生成环境也正常,只有3.0.11在开发环境下报错


我在 codepen上测试未重现问题,用vite新生成的项目也没重现出来,我本地使用vue-cli开发项目 今天升级到 vue@3.0.11后出现的错误提示信息, 降级到3.0.5后提示信息就消失了。

image

avatar
Apr 9th 2021

Hi, thanks for your interest but Github issues are for bug reports and feature requests only. You can ask questions on the forum, the Discord server or StackOverflow.

avatar
tjk
Apr 10th 2021

I'm pretty sure this was a bug (I just ran into it too) and I think it is fixed by this patch: https://github.com/vuejs/vue-next/commit/abd129d845951737c335a80a8af6cf7b0df2f74d. It should be fixed in 3.0.11 but maybe @gezhigang1005 you have an older version of @vue/compiler-core still being pulled in?

(should no longer codegen _resolveComponent('_self') I believe)

avatar
Apr 23rd 2021

It definitely looks like a vue-3 bug and should be reopened, I have the same troubles, vue version is 3.0.11. Workaround is to register a recursive globally and to give it a different name, otherwise it will fail to resolve it.

app.component('RecursiveItemWorkaroundComponent', RecursiveItem);

PS: Finally got how to fix it, just bumping compiler to @vue/compiler-sfc": "^3.0.11" doesn't work, so I removed node_modules and run npm install, now it works ok without globally registered components.

avatar
Apr 27th 2021

Agree with the others--this was a bug, upgrading to 3.0.11 for vue and @vue/compiler-sfc resolved it for me. Thanks for the suggestion!

avatar
May 14th 2021

I updated to Vue 3.0.11 and compiler-sfc 3.0.11 and still face the issue when I do app.use()

avatar
Sep 8th 2021

same question. vue:3.2.10 @vue/compiler-sfc:3.2.10

avatar
Sep 8th 2021

@XMBLDB could you provide a mini repro?