Skip to content

chore(testing): pin vite resolution on yarn for vite 7 downgrade#35586

Open
leosvelperez wants to merge 1 commit intomasterfrom
fix/e2e-yarn-vite7-downgrade-install
Open

chore(testing): pin vite resolution on yarn for vite 7 downgrade#35586
leosvelperez wants to merge 1 commit intomasterfrom
fix/e2e-yarn-vite7-downgrade-install

Conversation

@leosvelperez
Copy link
Copy Markdown
Member

Current Behavior

The cypress-legacy and vite e2e tests downgrade vite + @vitejs/plugin-react in package.json and then run install to verify backward compatibility with Vite 7. On yarn classic this trips a linker bug:

error Invariant Violation: could not find a copy of vite to link in
    .../node_modules/vitest/node_modules

Root cause: vitest@~4.1.0 declares vite as both a regular dependency AND a peerDependency. yarn 1's hoisting algorithm fails when intersecting a top-level ^7.0.0 range with that combo (the bug does not fire for ^8.0.0, exact versions, or differently-formatted ranges like 7.x). It is not specific to the in-test downgrade — the same setup fails from a completely empty directory.

Linux/yarn/20 e2e-cypress and Linux/yarn/20 e2e-vite have been failing every nightly since the in-test Vite 7 downgrade was introduced in #34850.

Expected Behavior

The cypress-legacy and vite e2e tests pass on yarn classic again with Vite 7.

The fix adds a yarn-only resolutions entry pinning vite so yarn commits to a single version up front and skips the buggy hoisting code path. npm/pnpm don't have the bug and ignore the field.

Validation

Verified via a manually-dispatched e2e nightly run on this branch (with the matrix temporarily narrowed to Linux/yarn/20 × {e2e-cypress, e2e-vite}, the matrices that fail on master): https://github.com/nrwl/nx/actions/runs/25431401390 — both jobs passed.

The cypress-legacy and vite e2e tests downgrade vite + plugin-react
in package.json then run install. On yarn classic this trips a
linker bug ("Invariant Violation: could not find a copy of vite to
link in node_modules/vitest/node_modules") because vitest declares
vite as both a regular dependency and a peerDependency, and yarn
1's hoisting algorithm fails when intersecting a top-level
`^7.0.0` range with vitest's vite range.

Add a yarn-specific `resolutions` entry pinning vite so yarn
commits to a single version up front and skips the buggy code
path. npm/pnpm don't have the bug and ignore the field.
@leosvelperez leosvelperez requested a review from a team as a code owner May 6, 2026 11:39
@leosvelperez leosvelperez requested a review from FrozenPandaz May 6, 2026 11:39
@leosvelperez leosvelperez self-assigned this May 6, 2026
@netlify
Copy link
Copy Markdown

netlify Bot commented May 6, 2026

Deploy Preview for nx-dev ready!

Name Link
🔨 Latest commit 7064d8e
🔍 Latest deploy log https://app.netlify.com/projects/nx-dev/deploys/69fb2890878fc600085704ce
😎 Deploy Preview https://deploy-preview-35586--nx-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 6, 2026

Deploy Preview for nx-docs ready!

Name Link
🔨 Latest commit 7064d8e
🔍 Latest deploy log https://app.netlify.com/projects/nx-docs/deploys/69fb28900aaafc0008e9afe0
😎 Deploy Preview https://deploy-preview-35586--nx-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@nx-cloud
Copy link
Copy Markdown
Contributor

nx-cloud Bot commented May 6, 2026

View your CI Pipeline Execution ↗ for commit 7064d8e

Command Status Duration Result
nx affected --targets=lint,test,build,e2e,e2e-c... ⛔ Cancelled 3m 55s View ↗
nx run-many -t check-imports check-lock-files c... ✅ Succeeded 4s View ↗
nx-cloud record -- pnpm nx-cloud conformance:check ✅ Succeeded 17s View ↗
nx build workspace-plugin ✅ Succeeded <1s View ↗
nx-cloud record -- nx sync:check ✅ Succeeded 25s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 6s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-06 14:51:37 UTC

@leosvelperez leosvelperez enabled auto-merge (squash) May 6, 2026 13:28
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

Successfully merging this pull request may close these issues.

2 participants