unplugin/unplugin-vue-components

components from `__mocks__` library appear in console warnings

davidmeirlevy opened this issue · 1 comments

Describe the bug

I use this library to add vuetify / element-plus components.
when I run vite dev en environment, I get this warning at the terminal console:

[unplugin-vue-components] component "FormComponent"(/dev/my-app/__mocks__/FormComponent.vue) has naming conflicts with other components, ignored.

I tried to make it ignore the mocks, but without any success. here's a sample of my vite config:

import Components from "unplugin-vue-components/vite";
export default defineConfig({
  plugins: [
    vue(),
    Components({
      dts: false,
      resolvers: [VuetifyResolver(), ElementUiResolver()],
      exclude: ["**/__mocks__/**"],
      types: [
        {
          from: "vue-router",
          names: ["RouterLink", "RouterView"],
        },
      ],
    }),
 ]
});

I also tried to exclude the mocks using regex, like /[\\/]__mocks__[\\/]/ or /__mocks__/.

It looks like something I assumed should be ignored by default. isn't it?
Is there maybe something wrong with my vite config?

Thanks.

Reproduction

https://stackblitz.com/edit/vitejs-vite-miygrx?file=vite.config.js

System Info

System:
    OS: macOS 14.5
    CPU: (10) arm64 Apple M1 Max
    Memory: 555.42 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.10.0 - ~/.nvm/versions/node/v20.10.0/bin/node
    npm: 10.2.3 - ~/.nvm/versions/node/v20.10.0/bin/npm
    pnpm: 9.5.0 - ~/Library/pnpm/pnpm
    bun: 1.1.18 - /opt/homebrew/bin/bun
  Browsers:
    Chrome: 127.0.6533.89
    Safari: 17.5
    Safari Technology Preview: 18.0

Used Package Manager

npm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.