Repository navigation
fix(deps): update vite to 2.9 so the config loads on current Node - #52
Merged
Merged
Conversation
Vite 2.2 loads vite.config.js with require() and expects ESM syntax to throw. Node 20.19+ and 22.12+ load it as a module namespace instead, which Vite rejects with 'config must export or return an object'. Vite 2.9, within the existing ^2.2.1 range, bundles the config first.
🟢 Tier S · Ready to mergeThe lockfile upgrades Vite and its build-tool dependencies while leaving the package manifest unchanged. A reusable GitHub Actions verify workflow is added for pull requests and pushes to main.
📂 Walkthrough · 2
🔇 Filtered out · 2Findings Hansi considered but did not post.
Reviewed |
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.
Cause
package-lock.jsonpinsvite@2.2.1. Vite 2.2 loadsvite.config.jsby callingrequire()on it and relies on the ESMexport defaultthrowing, so it can fall back to bundling. Node 20.19+ and 22.12+ supportrequire(esm), so therequire()succeeds and returns a module namespace object, which Vite 2.2 rejects withconfig must export or return an object. The build still works on Node 16, but fails on Node 24, which the verify job in #51 uses.Fix
npm update vite: the lockfile moves tovite@2.9.18, the last 2.x release and still inside the existing^2.2.1range, sopackage.jsonis unchanged. Vite 2.9 bundles the config with esbuild before loading it. The rest of the lockfile change is Vite's own tree (esbuild 0.14, rollup 2.77, postcss 8.5 within^8.2.12).Also adds the shared verify caller (identical to #51) so this PR runs the same check.
Verification
On Node 24.22:
npm ciandnpm run buildsucceed and emit the sameindex.html, CSS and JS bundles as the old lock does on Node 16.Unblocks #51.