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

exported vitest members are auto imported in app if referenced within a callback #516

Open
5 tasks done
christianlime opened this issue Jul 23, 2024 · 1 comment
Open
5 tasks done

Comments

@christianlime
Copy link

christianlime commented Jul 23, 2024

Describe the bug

If any auto import keywords are referenced as defined variable in a callback, an error is thrown

e.g. vitest exports it, and if we have const filteredArr = arr.filter((it) => it.data) within our app, an error is thrown.

On our side we can fix by renaming it to anything else, but it was a little bit of an investigation to find it out.

Linked is a simple devbox reproducing the error

Reproduction

https://codesandbox.io/p/sandbox/autoimport-bug-nxn56h

System Info

n/a

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.
@jack-allocate
Copy link

You should be able to create a vitest.config.ts, and then pass a different auto import configuration to that. The auto configuration in your vite.config.ts should not have vitest in it.

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

2 participants