mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #394] [MERGED] fix: Pages Router prod hydration for inlined page modules #538
Labels
No labels
enhancement
enhancement
good first issue
help wanted
nextjs-tracking
nextjs-tracking
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/vinext#538
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/cloudflare/vinext/pull/394
Author: @JaredStowell
Created: 3/10/2026
Status: ✅ Merged
Merged: 3/10/2026
Merged by: @james-elicx
Base:
main← Head:jstowell/fix-pages-router-client-manifest📝 Commits (7)
9658e4eClarify chunk manifest structures728b697Fix SSR manifest basePath URLs3a41fddFix SSR manifest basePath handling409de09Fix SSR manifest basePath handlinga28a671make ci happy3d31023bonk4da1524Merge branch 'main' into jstowell/fix-pages-router-client-manifest📊 Changes
6 files changed (+560 additions, -45 deletions)
View changed files
📝
packages/vinext/src/index.ts(+132 -16)📝
packages/vinext/src/server/prod-server.ts(+27 -23)➕
packages/vinext/src/utils/manifest-paths.ts(+19 -0)📝
tests/build-optimization.test.ts(+132 -0)📝
tests/deploy.test.ts(+25 -5)📝
tests/pages-router.test.ts(+225 -1)📄 Description
This fixes a Pages Router bug where SSR worked but interactive pages failed to hydrate when the page module was inlined into the client entry chunk.
For affected routes like
/counter, the server looked up the page inssr-manifest.jsonto decide which client assets to inject. When Vite inlined that page into the main client entry, the page’s SSR manifest entry was emitted as empty, so the server rendered HTML but never loaded the page’s client code. The result was a silent hydration miss in production on Node.The fix backfills
ssr-manifest.jsonfrom the emitted client bundle rather than relying only onmanifest.json. That lets us map source page modules to the chunk that actually contains them, including:basePath/ Vitebase-prefixed asset URLsTest coverage was expanded to prove the runtime path:
/countercasebasePath-prefixed emitted asset tagsVerification:
HEAD:/counterstayed atCount: 0andssr-manifest.json["pages/counter.tsx"]was empty/counterupdates toCount: 1🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.