New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot import * as components from '#components'
any more
#20733
Comments
My fix for now has been to do this: I think it'd be good to create the components registered in my module to be able to be imported from a file alias like I had been doing with #components but best practices or suggestions always welcome if you can spare a moment. I'm not sure I like the idea of auto registering these components as global for this functionality - it seems a bit hacky. |
importing all components via ( I think we can also transform this import but it's definitely not behaviour we'd advise in any case, for the negative performance reasons ... cc: @antfu |
import * as components from '#components'
* as components from '#components'
any more
OK I understand thank you :) |
+1 to Daniel. I think this is not a usage we should advise. A workaround to this is you can make the component you would like to reference this way global and use Vue's |
I can see why this is not advised so am happy to have an alternative. Are global components lazy loaded? I think what I'm trying to achieve is similar to #14036 My API is returning data with the name of the dynamic component to be loaded. So I have a resource loader component which is taking this name and then loading that in if it exists. It'd be a shame if I have to bundle every possible component into the main bundle. Or am I missing something in that global components have good performance and aren't all included in the main bundle? |
Thanks both @antfu and @danielroe Thanks again both. |
Environment
Darwin
v16.16.0
3.4.3
2.4.0
npm@8.11.0
vite
-
-
-
Reproduction
In a component I am using
And had been creating a computed ref like so
Describe the bug
Now when the computed ref is called
components
is undefinedAdditional context
I'm not sure if it's related to this or not?
#20547
Additionally, if there is a better way to check for a global component within another component by name and return said component for use in aa dynamic
<component>
component, that'd be great to know.If that sentence isn't too confusing.
Logs
No response
The text was updated successfully, but these errors were encountered: