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

components from __mocks__ library appear in console warnings #790

Open
5 tasks done
davidmeirlevy opened this issue Aug 7, 2024 · 1 comment
Open
5 tasks done

Comments

@davidmeirlevy
Copy link

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.
Copy link

stackblitz bot commented Aug 7, 2024

Fix this issue in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

@davidmeirlevy davidmeirlevy changed the title components from __mocks__ library appears in console warnings components from __mocks__ library appear in console warnings Sep 11, 2024
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

1 participant