feat!: require vite 6+, node.js 22.22+ - #712
Conversation
✅ Deploy Preview for remix-edge ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for remix-serverless ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
📝 WalkthroughWalkthroughThe Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/vite-plugin-react-router/package.json`:
- Line 78: Update the Vite version constraints in package.json to exclude
vulnerable releases. Change the peerDependencies vite constraint from ">=6.0.0"
to ">=6.4.3" to patch the HIGH-severity server.fs.deny bypass vulnerability on
Windows and associated MODERATE issues. Additionally, update devDependencies
vite to "^8.0.16" to ensure the patched version of Vite 8 that addresses the
same HIGH and MODERATE vulnerabilities is used.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3f601bf7-6eac-4f8d-a223-418ff2dfa73a
📒 Files selected for processing (1)
packages/vite-plugin-react-router/package.json
🔗 Linked repositories identified
CodeRabbit considers these linked repositories for cross-repo context during reviews:
netlify/blueprints(manual)
I believe this is the lowest we can go to support React Router 8 while retaining support for React Router 7.
c6a921b to
5b37498
Compare
## Description React Router 8 has just been released. [React Router 8](https://reactrouter.com/upgrading/v7) makes the Vite Environment API mandatory and supports Vite 7-8. React Router 7 supports Vite 6-7 (and 8, starting with 7.14) but users can opt in to this mode as well via `future.v8_viteEnvironmentApi`. Either way, the Vite Env API is forward compatible from the "client" and "ssr" pseudo-environments present previously, and those are backwards compatible as well. The main change to contend with here is reading from `config.environments?.ssr?.build` instead of `config.ssr.build` directly. This is supported by all combinations of versions and flags listed above. **Edit:** I ended up doing this via the `configEnvironment` hook, which is equivalent but runs after React Router has actually configured its environments. We also replace `isSsrBuild` with a simple `applyToEnvironment` hook, which is compatible with all these combinations as well. Finally, this starts reading from `rolldownOptions` and falling back to `rollupOptions`. This was entirely optional, but since the latter is soft-deprecated, I introduced this here. Again, all combinations of versions and flags are compatible with this. Essentially: ``` Vite 5 Vite 6 Vite 7 Vite 8 RR7 EOL ✓ ✓ ✓ (Vite 8 requires RR 7.14.0+) RR8 EOL — ✓ ✓ ``` Now, unfortunately I ended up also needing to somewhat fundamentally rework the whole plugin's approach. The previous approach was to register our own input that wraps the (leakily) expected React Router input. This is now fundamentally incompatible with React Router 8 as soon as a site has any prerendered pages, because React Router 8 uses a separate Vite Environment `prerender` that it builds by first building the other envs, then starting a preview server, making real HTTP requests to each path to be prerendered, and saving the response to disk. This request was failing, seemingly due to some [assumption in React Router 8 that is not happy with its own entry coexisting with another](https://github.com/remix-run/react-router/blob/da102b5928d2cf0b94cd0abc2895d0939698e7e9/packages/react-router-dev/vite/plugin.ts#L3578-L3586). Funny enough, I more or less ended up just porting parts of our [framework-agnostic plugin](https://github.com/netlify/framework-adapters/blob/69d233d505afb85d848f702e70441bc3e71008bd/packages/vite-plugin/src/lib/build.ts) here. The bulk of the diff in this PR is adding two new fixtures for RR8 serverless + RR7 edge, and refactoring the existing test suite to allow running table tests with different versions of Vite. This was important because in testing this locally I contended with all sorts of different behaviours across combinations. This is a bit clunky and will slow down CI but I believe it is worthwhile given all this combinatorial complexity. Closes #698 ## Related Tickets & Documents See also #711 and #712
🤖 I have created a release *beep* *boop* --- <details><summary>vite-plugin-react-router: 4.0.0</summary> ## [4.0.0](vite-plugin-react-router-v3.1.1...vite-plugin-react-router-v4.0.0) (2026-06-18) ### ⚠ BREAKING CHANGES * publish ESM only, remove CJS build ([#713](#713)) * require vite 6+, node.js 22.22+ ([#712](#712)) ### Features * publish ESM only, remove CJS build ([#713](#713)) ([1dece2c](1dece2c)) * require vite 6+, node.js 22.22+ ([#712](#712)) ([a99b5c4](a99b5c4)) * support Vite Env API and React Router 8 ([#714](#714)) ([eeb3a82](eeb3a82)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: token-generator-app[bot] <82042599+token-generator-app[bot]@users.noreply.github.com>
Description
I believe this is the lowest we can go to support React Router 8 while retaining support for React Router 7.
Note: bumped lowest tested node.js version in CI already in #709.