Skip to content

fix: add missing react-server-dom-webpack to App Router examples#132

Merged
FredKSchott merged 1 commit intocloudflare:mainfrom
gentritbiba:fix/examples-add-react-server-dom-webpack
Feb 27, 2026
Merged

fix: add missing react-server-dom-webpack to App Router examples#132
FredKSchott merged 1 commit intocloudflare:mainfrom
gentritbiba:fix/examples-add-react-server-dom-webpack

Conversation

@gentritbiba
Copy link
Copy Markdown
Contributor

@gentritbiba gentritbiba commented Feb 26, 2026

Summary

  • Add react-server-dom-webpack as an explicit dependency to all App Router examples that were missing it: app-router-cloudflare, app-router-playground, benchmarks, hackernews, nextra-docs-template
  • Fixes client-side hydration being completely broken in dev mode — "use client" components rendered as static HTML with no interactivity

Closes #28

Root Cause

@vitejs/plugin-rsc correctly adds react-server-dom-webpack/client.browser to optimizeDeps.include for the client environment, but pnpm's strict module resolution prevents Vite from resolving it unless the package is explicitly listed in the project's package.json. This caused:

Failed to resolve dependency: react-server-dom-webpack/client.browser, present in client 'optimizeDeps.include'

The CJS file was served raw to the browser, resulting in ReferenceError: module is not defined, which broke React's RSC client integration and all hydration.

Test plan

  • Start examples/app-router-cloudflare with vite dev
  • Verify no Failed to resolve dependency warnings in console
  • Verify no ReferenceError: module is not defined in browser console
  • Verify "use client" Counter component increments on click

App Router examples were missing react-server-dom-webpack as an explicit
dependency. With pnpm's strict module resolution, this caused the Vite
dev server to fail resolving react-server-dom-webpack/client.browser,
breaking client-side hydration — "use client" components rendered as
static HTML with no interactivity.

The @vitejs/plugin-rsc correctly adds react-server-dom-webpack to
optimizeDeps.include, but the package must be resolvable from the
project root. Without it in package.json, pnpm cannot link it.
@FredKSchott
Copy link
Copy Markdown
Collaborator

LGTM! Thanks @gentritbiba !

@FredKSchott FredKSchott enabled auto-merge (squash) February 27, 2026 06:36
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Feb 27, 2026

Open in StackBlitz

npm i https://pkg.pr.new/vinext@132

commit: f1431d5

@FredKSchott FredKSchott merged commit 4a81f9f into cloudflare:main Feb 27, 2026
20 checks passed
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.

vinext dev fails: cannot find @vitejs/plugin-rsc/rsc + unresolved react-server-dom-webpack/* in optimizeDeps.include

2 participants