Chrome 73.0.3683.86 / MacOS Mojave 10.14.2
When dynamically importing Vue components
Vue.component(componentName, () => import(`${componentPath}.vue`));
(I use this to render component in a modal)
getting error:
[Vue warn]: Unknown custom element: <ComponentName> - did you register the component correctly? For recursive components, make sure to provide the "name" option.
To reproduce:
If I register all the components manually in the main app file before initializing, all the components work fine even when VueDevtools are open.
Expected to render dynamic components the same way with or without VueDevtools open
The issue only happens when VueDevtools (5.0.6) is open in Chrome.
Please provide a runnable reproduction. I couldn't reproduce on dev branch.
Here is a runnable reproduction
https://github.com/fweibel/dynamicimportbug
Steps:
If the vue-devtool extension is not loaded/activated, the component will be loaded without any problem.
Thank you for your help on this.
How it going? I meet the same situation. If the devtools is closed, anything work well.
I'm having a similar issue here - it seems the "Vue" reference is suddenly something completely different when DevTools is active - seems localized to where it's being called from, so that components end up being registered in different contexts, and thus are unknown when referenced elsewhere. I've dumped
Vue.options.components in locations where I call Vue.component(), and I get blank objects, compared to ones filled with what I am expecting elsewhere
(I even went as far as storing the Vue argument as passed to the plugin's install() method internally somewhere to test - and using it to call Vue.component() instead of one from import Vue from 'vue' - but they still end up being registered somewhere else, isolated..)
Any chance this would get fixed?
The same happens to me over here, in fact I found this issue while googling the strange behavior. vue-devtools version 5.3.3
Same thing happens to me too :(
Reading the title of #1013 ("Can't register dynamic components outside of life-cycle hooks with vue-devtools open") inspired me to try a _horrible_ hack, that sorta works in my case because I have references to the comps:
Use <component :is="yourDynamicallyLoadedComponent" /> :脴
Most helpful comment
Here is a runnable reproduction
https://github.com/fweibel/dynamicimportbug
Steps:
If the vue-devtool extension is not loaded/activated, the component will be loaded without any problem.
Thank you for your help on this.