unjs/unimport

Duplicate import warning when linking to a package

Opened this issue · 1 comments

Environment

Node v18.16.0, Nuxt 3.7.1, Unimport 3.3.0

Reproduction

In v3.3.0 both the .d.ts and .mjs files are being imported from a linked package, causing import warnings.

Describe the bug

I have a nuxt module that registers a directory of composables for auto-import. It works fine when installed to node_modules, but as of unimport@3.3.0 there is now a warning that occurs whens the module is linked.

Duplicated imports "useLog", the one from "[path to package]/dist/runtime/composables/core/useLog.d.ts" has been ignored

It looks like scanFilesFromDir should be ignoring the .d.ts files, but it doesn't work when the package is linked.

Additional context

No response

Logs

No response

We are also seeing this with various nuxt modules which register composables for auto importing as well as importing and using those composables internally within registered components!