-
-
Notifications
You must be signed in to change notification settings - Fork 356
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
feat: support add components prefix #612
base: main
Are you sure you want to change the base?
Conversation
Another issue about that #438 |
+1. Need this feature for testing a Nuxt package where components have a prefix. Did anyone find a workaround for now? |
Would be a really useful feature, for example for PrimeVue, where compontents have no prefix. |
Hey @winchesHe I tried out your fork, but I can't get it to work. Hope you could help me. I'm trying to get this to work in my Vitest setup, but it always fails to resolve components.
That component is located at I tried this: Components({
dts: true,
dirs: ["src/runtime/components"],
deep: true,
compPrefix: "Mc",
directoryAsNamespace: true,
allowOverrides: false,
}) But with no luck. Any idea on what to try or how to debug? |
maybe try the directoryAsNamespace false |
Also tried that. Still nothing. Is there a way to check which components it got and how it named them? |
Another way I know is change the file name, It seems to be generated based on the file name. If you want to check how it named them you can debug the plugin in you editor. |
will this get merged? |
Description
Add a custom configuration
compPrefix
Support adding a prefix to the custom components type name generated by the unplugin
Example:
-- TestComp: typeof import('src/component/TestComp')['default']
++ ElTestComp: typeof import('src/component/TestComp')['default']
-- TestComp: typeof import('test/component/TestComp')['default']
++ ElTestComp: typeof import('test/component/TestComp')['default']
OtherTestComp: typeof import('src/component/TestComp')['default']
Linked Issues
#372 how to add prefix with src/components or dirs ?
#385 How to add the prefix of all components in the 'src/components' directory ?
Additional context
I test this in my protect and it perform perfectly.