fix: pin vite ^5 to restore vitest CJS compatibility (fixes test + smoke CI)#117
Merged
chrismaz11 merged 1 commit intomasterfrom Apr 11, 2026
Merged
fix: pin vite ^5 to restore vitest CJS compatibility (fixes test + smoke CI)#117chrismaz11 merged 1 commit intomasterfrom
chrismaz11 merged 1 commit intomasterfrom
Conversation
Vite 7 dropped its CJS Node.js API. Since the project is type:commonjs, vitest's CJS config loader (vitest/dist/config.cjs) fails to require() vite 7's ESM-only dist/node/index.js with ERR_REQUIRE_ESM. Pinning vite to ^5 (5.4.21) restores the CJS shim that vitest needs. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
There was a problem hiding this comment.
Pull request overview
Pins Vite to the v5 major line via npm overrides to restore Vitest’s CJS config-loader compatibility in this CommonJS repo, resolving the CI failures caused by Vite v7’s ESM-only Node API.
Changes:
- Add an npm
overridesentry to forceviteto^5(compatible with Vitest’s CJS bootstrap path). - Regenerate
package-lock.jsonto resolveviteto5.4.21and update related transitive dependencies.
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| package.json | Adds overrides.vite = "^5" alongside the existing serialize-javascript override. |
| package-lock.json | Updates the resolved Vite version to 5.4.21 and adjusts Vite’s transitive dependency graph accordingly. |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
Both
testandsigned-receipt-smokeCI jobs fail with:Root cause: The project is
"type": "commonjs". Vitest 3.x uses a CJS entry (vitest/dist/config.cjs) to bootstrap the config loader, which internallyrequire()s vite. Vite 7 dropped its CJS Node.js API —dist/node/index.jsis now pure ESM, sorequire()fails.Fix
Add
"vite": "^5"to package.json overrides. Vite 5 (5.4.21) retains the CJS compatibility shim that vitest's CJS loader needs. The lockfile is regenerated.Both
serialize-javascript(7.0.5) andvite(5.4.21) overrides coexist cleanly.Test plan
testjob passessigned-receipt-smokejob passes🤖 Generated with Claude Code