dishait / vite-auto-import-resolvers

unplugin-auto-import 的 vite resolver
MIT License
56 stars 5 forks source link

Scan non `default` exports #4

Closed aussieboi closed 1 year ago

aussieboi commented 2 years ago

Currently there is option to auto import composable that are only exported as default export

// src/composable/useFoo.ts

export default 1000

export const bar = 500

bar won't be able to be avaiable for autoimport, Yes I can add ne composable, but in some cases it would be better to have in same file cause they in same context, and its better for tree-shaking.

Food for thought.

markthree commented 2 years ago

@aussieboi handsome young man,I like your proposal,But I haven't figured out how to do this while maintaining good development performance。

markthree commented 2 years ago

In addition, two modules may have the same variable name export, which will confuse the import

aussieboi commented 2 years ago

@markthree tnx, I just saw PR from Anthony Fu for nuxt he uses https://github.com/unjs/mlly maybe it can help will help, will have more time over weekend so I can try with a PR if you are open for it.

https://github.com/nuxt/framework/pull/1176/files#diff-6c8c2caa6821b7891318348cb0dbb7350318c97a91eeeb29eea9243d28ae9656

In addition, two modules may have the same variable name export, which will confuse the import

Can add warning/error so dev will need to resolve this. conflict

markthree commented 2 years ago

@aussieboi amazing,Welcome PR, but I hope it becomes an option

aussieboi commented 2 years ago

sry got busy, will try to check it soon.

markthree commented 2 years ago

@aussieboi Don't be nervous. I'll pay attention whenever you have time to mention pr。😁

aussieboi commented 2 years ago

Since unplugin-auto-import supprots dirs options i switched back to it, won't be needing this feature, as time is hectic right now, so not time for adding something like that.

Sry if somebody want's play with this feel free will be here and follow issue.

markthree commented 2 years ago

@aussieboi Thank you for your information