Related plugins
Describe the bug
First of all, I'm not sure where best to report the issue, but since the bug can be fixed with a quick fix in this repository (see below), I think that's the best place to start.
When I use the plugin in vitest and with vite-rolldown, I get the following warning in the console:
Both esbuild and oxc options were set. oxc options will be used and esbuild options will be ignored.
[vite] (client) Re-optimizing dependencies because vite config has changed
[vite] (client) ✨ optimized dependencies changed. reloading
[vitest] Vite unexpectedly reloaded a test. This may cause tests to fail, lead to flaky behaviour or duplicated test runs.
For a stable experience, please add mentioned dependencies to your config's `optimizeDeps.include` field manually.
The problem seems to be related with this change. If I revert
optimizeDeps: {
rollupOptions: {
transform: { jsx: { runtime: "automatic" } }
}
}
to
optimizeDeps: {
rollupOptions: { jsx: { mode: "automatic" } },
}
it goes away. Unfortunately I couldn't find any documentation about this option in vite-rolldown.
Reproduction
https://github.com/jhnns/vitest-rolldown-react-bug
Steps to reproduce
npm i
npm test
It will output the warning.
Note: Although the test do run in this example, this causes our test suite to fail in the first run when running vitest (in watch mode):
Error: Failed to import test file /path/to/our/test-setup/file.ts
Caused by: Error: Vitest failed to find the runner. This is a bug in Vitest. Please, open an issue with reproduction.
If I run the test a second time (pressing Enter) it will succeed.
This problem only exists with vite-rolldown, it won't happen with regular vite.
System Info
System:
OS: macOS 15.6.1
CPU: (10) arm64 Apple M1 Pro
Memory: 106.03 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 22.14.0 - ~/.local/state/fnm_multishells/51238_1757933721456/bin/node
Yarn: 1.22.22 - ~/.local/state/fnm_multishells/51238_1757933721456/bin/yarn
npm: 10.9.2 - ~/.local/state/fnm_multishells/51238_1757933721456/bin/npm
pnpm: 9.15.9 - ~/.local/state/fnm_multishells/51238_1757933721456/bin/pnpm
Browsers:
Chrome: 140.0.7339.133
Safari: 18.6
npmPackages:
@vitejs/plugin-react: ^5.0.2 => 5.0.2
@vitejs/plugin-react-oxc: ^0.4.1 => 0.4.1
rolldown-vite: 7.1.10
Used Package Manager
npm
Logs
No response
Validations
Related plugins
plugin-react
plugin-react-swc
plugin-react-oxc
plugin-rsc
Describe the bug
First of all, I'm not sure where best to report the issue, but since the bug can be fixed with a quick fix in this repository (see below), I think that's the best place to start.
When I use the plugin in vitest and with vite-rolldown, I get the following warning in the console:
The problem seems to be related with this change. If I revert
to
it goes away. Unfortunately I couldn't find any documentation about this option in vite-rolldown.
Reproduction
https://github.com/jhnns/vitest-rolldown-react-bug
Steps to reproduce
npm inpm testIt will output the warning.
Note: Although the test do run in this example, this causes our test suite to fail in the first run when running
vitest(in watch mode):If I run the test a second time (pressing Enter) it will succeed.
This problem only exists with
vite-rolldown, it won't happen with regularvite.System Info
Used Package Manager
npm
Logs
No response
Validations