Skip to content
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

Support custom resolvers #231

Open
antfu opened this issue Sep 6, 2021 · 1 comment
Open

Support custom resolvers #231

antfu opened this issue Sep 6, 2021 · 1 comment

Comments

@antfu
Copy link
Member

antfu commented Sep 6, 2021

Similar approach to https://github.com/antfu/unplugin-vue-components#importing-from-ui-libraries

I been using this pattern for unplugin-vue-components for a while and I think it turns out a flexible and straightforward solution to support various component libraries without the changes need to be done on the author side. For example, some components might use JSX to build up the library, or uses all named exports on the top-level module, or imports styles separately. Additionally, the resolver opens more possibility to integrate on-demand usages, for example unplugin-icons which the icons are served virtually via module name. This would also be great if we could join the force from the Vite side to provide a uniformed resolver solution and made it easier for ppl adopting to more libraries at ease.

@pi0
Copy link
Member

pi0 commented Sep 6, 2021

(mirrored from framework repo)

Ideally, we should make PR to expose <lib>/nuxt module (like this) for proper nuxt integration with each of those libraries for taking advantage of all nuxt and hook possibilities and easier/consistent installation without import in nuxt.config. (*)

But seems a good idea to have compatibility with vite format. Basically, we shall extend ComponentsDir interface and detect/support a new format in the scanner to generate necessary entries.

(*) Other than integration possibilities, one major difference is that nuxt components mainly work with SFCs and require component libraries to expose them rather than a single bundle. This allows smart bundling with minimum transpile and dynamic injection of styles only when needed rather than global.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants