Subscribe on changes!

global component Failed to resolve component: hello-word

avatar
Sep 27th 2022

Vue version

3.2.39

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-jncq5p?file=src/test-com/src/index.vue

Steps to reproduce

  1. open link
  2. click "append helloword com to body" button

What is expected?

append

<div>hello word2</div>
<hello-word>测试</hello-word>

to body

What is actually happening?

append

<div>hello word2</div>

to body

System Info

Failed to resolve component: hello-word
If this is a native custom element, make sure to exclude it from component resolution via compilerOptions.isCustomElement.

Any additional comments?

No response

avatar
Sep 27th 2022

Why global components cannot be resolved

avatar
Sep 27th 2022

Manually calling render creates a tree that doesn't belong to the current app instance, so it can't resolve components registered under the app's scope.

avatar
Sep 27th 2022

Manually calling render creates a tree that doesn't belong to the current app instance, so it can't resolve components registered under the app's scope.

Then how should I deal with this problem

avatar
Sep 29th 2022

@LinusBorg

avatar
Sep 29th 2022

use createApp instead of render and re-register all global components with that new app.

If you have further questions, use our Discord server or open a discussion in the repo discussions area.