Open
Description
I'm using React Router as a...
framework
Reproduction
https://stackblitz.com/edit/github-qah1efnd?file=package.json
When running pnpm vitest
the test fails, because react router vite plugin adds the import
condition and a package in the @sentry/node
dependencies distributes invalid ESM without the .js extension
Vitest Vite config should not have the module
condition in ssr as you can see from this comment
System Info
System:
OS: macOS 15.5
CPU: (10) arm64 Apple M2 Pro
Memory: 85.98 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 24.2.0 - ~/.local/share/pnpm/node
Yarn: 1.22.22 - /usr/local/bin/yarn
npm: 11.3.0 - ~/.local/share/pnpm/npm
pnpm: 10.12.1 - ~/.local/share/pnpm/pnpm
bun: 1.2.9 - ~/.bun/bin/bun
Browsers:
Chrome: 137.0.7151.120
Safari: 18.5
npmPackages:
@react-router/dev: ^7.6.2 => 7.6.2
@react-router/fs-routes: ^7.6.2 => 7.6.2
@react-router/node: ^7.6.2 => 7.6.2
@react-router/serve: ^7.6.2 => 7.6.2
react-router: ^7.6.2 => 7.6.2
vite: ^6.3.5 => 6.3.5
Used Package Manager
npm
Expected Behavior
Vitest should work even if the react router plugin is applied in the vite config
Actual Behavior
Adding react router Vite plugin breaks Vitest tests when you use a package like @sentry/node