[PR #31] [MERGED] fix: install react-server-dom-webpack during init and deploy for App Router #254

Closed
opened 2026-05-06 12:38:47 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/31
Author: @southpolesteve
Created: 2/24/2026
Status: Merged
Merged: 2/25/2026
Merged by: @southpolesteve

Base: mainHead: fix/create-next-app-missing-rsdw


📝 Commits (5)

  • 9c8a540 fix: install react-server-dom-webpack during init and deploy for App Router
  • b866be0 refactor: use createRequire for package resolution instead of direct node_modules reads
  • db455c8 ci: add Windows to create-next-app smoke test
  • d4ad795 fix: use pathToFileURL for dynamic import() calls on Windows
  • 4ddd18a fix: pathToFileURL for cache-runtime codegen and test imports

📊 Changes

8 files changed (+382 additions, -24 deletions)

View changed files

📝 .github/workflows/ci.yml (+71 -0)
📝 packages/vinext/src/cli.ts (+5 -1)
📝 packages/vinext/src/deploy.ts (+37 -1)
📝 packages/vinext/src/index.ts (+10 -10)
📝 packages/vinext/src/init.ts (+76 -1)
📝 tests/deploy.test.ts (+64 -1)
📝 tests/init.test.ts (+109 -1)
📝 tests/pages-router.test.ts (+10 -9)

📄 Description

Summary

Fixes #22vinext init on a fresh create-next-app project fails with Could not resolve "react-server-dom-webpack/server.edge".

Root Cause

Two compounding issues:

  1. Missing dependency: getInitDeps() didn't include react-server-dom-webpack in the list of packages to install during vinext init. While vinext lists it as a direct dependency, Vite needs it resolvable from the project root node_modules/, not nested inside vinext/node_modules/.

  2. React version mismatch: react-server-dom-webpack@19.2.4 requires react@^19.2.4 as a peer dep, but create-next-app@latest ships react@19.2.3. This version conflict causes npm to either nest rsdw (npm 7-9) or hard-fail with ERESOLVE (npm 11+).

Fix

  • Add react-server-dom-webpack to getInitDeps() for App Router projects
  • Add getReactUpgradeDeps() that detects when the installed React is too old for rsdw
  • Before installing dev deps, upgrade react and react-dom as regular dependencies (without -D) to maintain their position in dependencies rather than devDependencies
  • Apply the same fix to vinext deploy for parity (per AGENTS.md guidance)
  • Add a CI smoke test that scaffolds a real create-next-app project, runs vinext init, starts the dev server, and verifies HTTP 200

Testing

  • 1814 existing tests pass (0 failures)
  • 12 new unit tests for getReactUpgradeDeps, rsdw dependency detection, and React upgrade ordering
  • New create-next-app CI job validates the end-to-end flow
  • Typecheck and lint clean

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/31 **Author:** [@southpolesteve](https://github.com/southpolesteve) **Created:** 2/24/2026 **Status:** ✅ Merged **Merged:** 2/25/2026 **Merged by:** [@southpolesteve](https://github.com/southpolesteve) **Base:** `main` ← **Head:** `fix/create-next-app-missing-rsdw` --- ### 📝 Commits (5) - [`9c8a540`](https://github.com/cloudflare/vinext/commit/9c8a54098def9a41266b12ec12af6e3b99088b8b) fix: install react-server-dom-webpack during init and deploy for App Router - [`b866be0`](https://github.com/cloudflare/vinext/commit/b866be09d67094faeadd7a4452f87c8c6a96acb3) refactor: use createRequire for package resolution instead of direct node_modules reads - [`db455c8`](https://github.com/cloudflare/vinext/commit/db455c8d600742701de7704c0441b37ebc3460e9) ci: add Windows to create-next-app smoke test - [`d4ad795`](https://github.com/cloudflare/vinext/commit/d4ad795ce0ca0320c33e424bb9f6ff7c9b5d08b5) fix: use pathToFileURL for dynamic import() calls on Windows - [`4ddd18a`](https://github.com/cloudflare/vinext/commit/4ddd18ab1a4369f3ec91485d0657efeaf4c731ef) fix: pathToFileURL for cache-runtime codegen and test imports ### 📊 Changes **8 files changed** (+382 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/ci.yml` (+71 -0) 📝 `packages/vinext/src/cli.ts` (+5 -1) 📝 `packages/vinext/src/deploy.ts` (+37 -1) 📝 `packages/vinext/src/index.ts` (+10 -10) 📝 `packages/vinext/src/init.ts` (+76 -1) 📝 `tests/deploy.test.ts` (+64 -1) 📝 `tests/init.test.ts` (+109 -1) 📝 `tests/pages-router.test.ts` (+10 -9) </details> ### 📄 Description ## Summary Fixes #22 — `vinext init` on a fresh `create-next-app` project fails with `Could not resolve "react-server-dom-webpack/server.edge"`. ## Root Cause Two compounding issues: 1. **Missing dependency**: `getInitDeps()` didn't include `react-server-dom-webpack` in the list of packages to install during `vinext init`. While vinext lists it as a direct dependency, Vite needs it resolvable from the **project root** `node_modules/`, not nested inside `vinext/node_modules/`. 2. **React version mismatch**: `react-server-dom-webpack@19.2.4` requires `react@^19.2.4` as a peer dep, but `create-next-app@latest` ships `react@19.2.3`. This version conflict causes npm to either nest rsdw (npm 7-9) or hard-fail with `ERESOLVE` (npm 11+). ## Fix - Add `react-server-dom-webpack` to `getInitDeps()` for App Router projects - Add `getReactUpgradeDeps()` that detects when the installed React is too old for rsdw - Before installing dev deps, upgrade `react` and `react-dom` as **regular dependencies** (without `-D`) to maintain their position in `dependencies` rather than `devDependencies` - Apply the same fix to `vinext deploy` for parity (per AGENTS.md guidance) - Add a **CI smoke test** that scaffolds a real `create-next-app` project, runs `vinext init`, starts the dev server, and verifies HTTP 200 ## Testing - 1814 existing tests pass (0 failures) - 12 new unit tests for `getReactUpgradeDeps`, rsdw dependency detection, and React upgrade ordering - New `create-next-app` CI job validates the end-to-end flow - Typecheck and lint clean --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 12:38:47 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#254
No description provided.