-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
(v2) Error: Failed to load url
when dynamic importing js files generated during tests with relative path
#6152
Comments
Error: Failed to load url
when dynamic importing js files generated during tests with relative pathError: Failed to load url
when dynamic importing js files generated during tests with relative path
Are you sure this is Vitest 2 issue, and not Vite 5? The error happens during static analysis and seems legit to me. |
I'm not really sure and it's hard to believe, but I can only reproduce from Vitest v2 while Vite version is pinned (as latest 5.3.4). I haven't debug the issue much, but just one surprising thing I found is that the test just succeeded when I added |
Hmm, after double checking reproduction, it doesn't look like this fails always 100% (but almost 95% locally). I'll check if I can reproduce it on Vite SSR alone. |
Running into the same issue (and only after Vitest v2 update). Relevant PR: |
I filed an issue on Vite vitejs/vite#17760. At least this seems to be an inconsistent behavior depending on |
I found why this started to happen since Vitest v2. It looks like Vite disables "cached fs" when users had custom |
Describe the bug
I was investigating a test failure when upgrading Vitest v2 in vite-plugin-react repo vitejs/vite-plugin-react#347 and this seems to be the cause.
Reproduction
code: https://github.com/hi-ogawa/reproductions/tree/main/vitest-plugin-react-v2
stackblitz: https://stackblitz.com/github/hi-ogawa/reproductions/tree/main/vitest-plugin-react-v2?file=src%2Frepro.test.ts
System Info
(stackblitz) System: OS: Linux 5.0 undefined CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz Memory: 0 Bytes / 0 Bytes Shell: 1.0 - /bin/jsh Binaries: Node: 18.20.3 - /usr/local/bin/node Yarn: 1.22.19 - /usr/local/bin/yarn npm: 10.2.3 - /usr/local/bin/npm pnpm: 8.15.6 - /usr/local/bin/pnpm npmPackages: vitest: 2.0.3 => 2.0.3
Used Package Manager
pnpm
Validations
The text was updated successfully, but these errors were encountered: