unplugin-auto-import icon indicating copy to clipboard operation
unplugin-auto-import copied to clipboard

Feature: Allow excluding from presets

Open Bobakanoosh opened this issue 3 years ago • 1 comments

Clear and concise description of the problem

I use the @vueuse/core preset. I have a useFileDialog function that comes from another library (with a preset).

Because @vueuse/core added useFileDialog recently, I now get this error: [vite] [auto-import] identifier useFileDialog already defined with @vueuse/core

Suggested solution

Allow some exclusion syntax in the vite plugin like:

exclude: ["@vueuse/core", ["useFileDialog"]]

Alternative

If I could use this syntax:

'@vueuse/core': [
        ['useFetch', 'useMyFetch'], // import { useFetch as useMyFetch } from '@vueuse/core',
],

then I could just rename the one coming from @vueuse/core.

However, It's not preferable to do this because then I lose all of the other imports that the @vueuse/core preset adds automatically.

Additional context

No response

Validations

  • [X] Follow our Code of Conduct
  • [X] Read the Contributing Guide.
  • [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.

Bobakanoosh avatar Sep 28 '22 17:09 Bobakanoosh

since you are using preset, it can be override. https://github.com/antfu/unplugin-auto-import/blob/main/src/types.ts#L121

azaleta avatar Sep 29 '22 12:09 azaleta