Conversation
✅ Deploy Preview for nx-dev ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Contributor
|
View your CI Pipeline Execution ↗ for commit 95ecfb3
☁️ Nx Cloud last updated this comment at |
1150242 to
084797a
Compare
FrozenPandaz
approved these changes
Mar 28, 2026
FrozenPandaz
left a comment
Contributor
There was a problem hiding this comment.
We should update vitest in the root package.json too right?
When creating a workspace with `create-nx-workspace` using presets that install vitest (react-monorepo with vite bundler, nuxt with vitest, vue, etc.) and npm as the package manager, `npm install` fails with ERESOLVE errors. This happens because vitest 4.0.x depends on `@vitest/mocker` which has a peer dependency on `vite: "^6 || ^7"` (no vite 8 support), while Nx installs `vite@^8.0.0` by default. Additionally, `@vitejs/plugin-react-swc@^3.5.0` has a peer dependency on `vite: "^4 || ^5 || ^6 || ^7"` (no vite 8), and the SWC compiler path in ensure-dependencies lacks version detection unlike the babel path. - vitest 4.1.x is installed, which supports vite 8 through its dependencies (`@vitest/[email protected]` includes `vite@^8` in peer deps) - `@vitejs/plugin-react-swc` version is selected based on the installed vite version (v4.3+ for vite 8, v3.x for older) Fixes NXC-4164
FrozenPandaz
pushed a commit
that referenced
this pull request
Mar 31, 2026
…pat (#35062) When creating a workspace with `create-nx-workspace` using presets that install vitest (react-monorepo with vite bundler, nuxt with vitest, vue, etc.) and **npm** as the package manager, `npm install` fails with `ERESOLVE unable to resolve dependency tree`. **Root cause:** vitest `~4.0.x` depends on `@vitest/[email protected]` which has a peer dependency on `vite: "^6.0.0 || ^7.0.0"` — it does **not** support vite 8. Since Nx now defaults to installing `vite@^8.0.0`, npm cannot satisfy `@vitest/mocker`'s peer dependency. Additionally, `@vitejs/plugin-react-swc@^3.5.0` has a peer dependency on `vite: "^4 || ^5 || ^6 || ^7"` (no vite 8 support), and the SWC compiler path in `ensure-dependencies.ts` lacks the vite-version detection logic that the babel path already has. - Workspaces using vite 8 + vitest install successfully with npm - `@vitejs/plugin-react-swc` version is selected based on the installed vite version (v4.3+ for vite 8, v3.x for older vite) 1. **Bump `vitestV4Version`** from `~4.0.0`/`~4.0.8` to `~4.1.0` in both `@nx/vite` and `@nx/vitest` — vitest 4.1.x's dependencies support vite 8 2. **Bump `vitestV4CoverageV8Version` and `vitestV4CoverageIstanbulVersion`** to `~4.1.0` to match 3. **Update `vitePluginReactSwcVersion`** from `^3.5.0` to `^4.3.0` (first version with vite 8 peer dep support), add `vitePluginReactSwcV3Version = '^3.5.0'` for backward compat 4. **Add vite-version detection** to the SWC path in `ensure-dependencies.ts` (both `@nx/vite` and `@nx/vitest`), mirroring the existing babel path logic Fixes NXC-4164 (cherry picked from commit c9253fb)
Contributor
|
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Current Behavior
When creating a workspace with
create-nx-workspaceusing presets that install vitest (react-monorepo with vite bundler, nuxt with vitest, vue, etc.) and npm as the package manager,npm installfails withERESOLVE unable to resolve dependency tree.Root cause: vitest
~4.0.xdepends on@vitest/[email protected]which has a peer dependency onvite: "^6.0.0 || ^7.0.0"— it does not support vite 8. Since Nx now defaults to installingvite@^8.0.0, npm cannot satisfy@vitest/mocker's peer dependency.Additionally,
@vitejs/plugin-react-swc@^3.5.0has a peer dependency onvite: "^4 || ^5 || ^6 || ^7"(no vite 8 support), and the SWC compiler path inensure-dependencies.tslacks the vite-version detection logic that the babel path already has.Expected Behavior
@vitejs/plugin-react-swcversion is selected based on the installed vite version (v4.3+ for vite 8, v3.x for older vite)Changes
vitestV4Versionfrom~4.0.0/~4.0.8to~4.1.0in both@nx/viteand@nx/vitest— vitest 4.1.x's dependencies support vite 8vitestV4CoverageV8VersionandvitestV4CoverageIstanbulVersionto~4.1.0to matchvitePluginReactSwcVersionfrom^3.5.0to^4.3.0(first version with vite 8 peer dep support), addvitePluginReactSwcV3Version = '^3.5.0'for backward compatensure-dependencies.ts(both@nx/viteand@nx/vitest), mirroring the existing babel path logicRelated Issue(s)
Fixes NXC-4164