[Vue warn]: Failed to resolve component: _self
Version
3.0.11
Reproduction link
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后提示信息就消失了。
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.
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)
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.
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!