Skip to content

fix(app-router): support soft navigation in static exports - #3112

Merged
james-elicx merged 10 commits into
mainfrom
codex/fix-static-export-soft-navigation
Aug 27, 2026
Merged

fix(app-router): support soft navigation in static exports#3112
james-elicx merged 10 commits into
mainfrom
codex/fix-static-export-soft-navigation

Conversation

@james-elicx

@james-elicx james-elicx commented Aug 26, 2026

Copy link
Copy Markdown
Member

Summary

  • emit App Router Flight payloads as .txt assets in output: "export", matching Next.js and the configured HTML/trailing-slash layout
  • fetch those portable text/plain assets for static-export navigation while preserving the visible URL, route params, metadata, and client document state
  • force export prefetches onto the available full-route artifact and fall back to the static 404 document when an artifact is missing
  • handle deployment skew, parallel-slot params, and basePath roots without falling back to a document navigation
  • namespace exported HTML, Flight, metadata, 404, and public/ assets under basePath for verbatim static hosts
  • extend the static-export fixture and comprehensive example verification

Next.js parity

This follows Next.js's export transport in packages/next/src/client/components/router-reducer/fetch-server-response.ts and its trailing-slash regression in test/e2e/app-dir/static-export-skew-trailing-slash/static-export-skew-trailing-slash.test.ts. The .txt extension is only a static-host transport name; the contents remain Flight/RSC bytes. Normal vinext server prerenders continue to emit .rsc.

Temporary CI prerequisite

This draft currently carries the two focused commits from #3108 because CI against main consistently reproduced the prerender footer and Node stream-test races that PR fixes. They remain separate from the static-export commits and can be dropped once #3108 lands.

Validation

  • vp check
  • vp test run tests/app-rsc-cache-busting.test.ts tests/prerender.test.ts (157 tests)
  • vp test run tests/link.test.ts (130 tests)
  • vp test run tests/app-prefetch-rsc-request.test.ts tests/app-browser-entry.test.ts (260 tests)
  • PLAYWRIGHT_PROJECT=static-export pnpm run test:e2e (23 tests)
  • PLAYWRIGHT_PROJECT=static-export-basepath pnpm run test:e2e (3 tests)
  • pnpm --dir examples/static-export build && pnpm --dir examples/static-export verify (50 emitted files)
@james-elicx
james-elicx force-pushed the codex/fix-static-export-soft-navigation branch from 02579a9 to 101d884 Compare August 26, 2026 22:45
@james-elicx james-elicx reopened this Aug 26, 2026
@james-elicx
james-elicx marked this pull request as ready for review August 26, 2026 22:46
@james-elicx
james-elicx marked this pull request as draft August 26, 2026 22:47
@pkg-pr-new

pkg-pr-new Bot commented Aug 26, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@vinext/cloudflare@3112
npm i https://pkg.pr.new/create-vinext-app@3112
npm i https://pkg.pr.new/@vinext/types@3112
npm i https://pkg.pr.new/vinext@3112

commit: a722e76

@github-actions

Copy link
Copy Markdown
Contributor
Example Preview Production Original
app-router-cloudflare preview production
pages-router-cloudflare preview production
app-router-playground preview production original
realworld-api-rest preview production
nextra-docs-template preview production
benchmarks preview production
hackernews preview production original
workers-cache preview production
static-export preview production
web preview production
@github-actions

github-actions Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Performance benchmarks

Compared a722e76 against base c1a78a7 using alternating same-runner rounds. Next.js was unchanged and skipped.

1 improved · 0 regressed · 5 within ±1.5%

Scenario Framework Baseline Current Change
Client bundle size (gzip) vinext 142.2 KB 142.2 KB ⚫ +0.0%
Client entry size (gzip) vinext 129.5 KB 129.5 KB ⚫ +0.0%
Dev server cold start vinext 3.20 s 3.14 s 🟢 -1.7%
Production build time vinext 3.47 s 3.43 s ⚫ -1.0%
RSC entry closure size (gzip) vinext 116.6 KB 116.6 KB ⚫ +0.0%
Server bundle size (gzip) vinext 198.1 KB 198.3 KB ⚫ +0.1%

View detailed results and traces

🟢 improvement · 🔴 regression · ⚫ change below 1.5% · paired base/head

@james-elicx
james-elicx changed the base branch from main to codex/fix-prerender-stale-time-race August 26, 2026 23:06
@james-elicx
james-elicx force-pushed the codex/fix-static-export-soft-navigation branch from 101d884 to 835a8a7 Compare August 26, 2026 23:06
@james-elicx
james-elicx changed the base branch from codex/fix-prerender-stale-time-race to main August 26, 2026 23:07
@james-elicx james-elicx reopened this Aug 26, 2026
@james-elicx
james-elicx force-pushed the codex/fix-static-export-soft-navigation branch from f3aa017 to f684a64 Compare August 26, 2026 23:10
@james-elicx
james-elicx marked this pull request as ready for review August 26, 2026 23:11
@james-elicx
james-elicx marked this pull request as draft August 26, 2026 23:11
@james-elicx james-elicx reopened this Aug 26, 2026
@james-elicx
james-elicx changed the base branch from main to codex/fix-prerender-stale-time-race August 26, 2026 23:13
@james-elicx
james-elicx changed the base branch from codex/fix-prerender-stale-time-race to main August 26, 2026 23:13
Comment thread tests/prerender.test.ts Fixed
@james-elicx
james-elicx marked this pull request as ready for review August 27, 2026 08:32
@james-elicx
james-elicx merged commit 2a2ce31 into main Aug 27, 2026
73 checks passed
@james-elicx
james-elicx deleted the codex/fix-static-export-soft-navigation branch August 27, 2026 10:01
fengmk2 added a commit to voidzero-dev/vite-plus that referenced this pull request Aug 29, 2026
## Summary

Update the pinned vinext revision to include the upstream fix for the
scheduled Ecosystem CI failure.

The fix was validated in cloudflare/vinext#3109, then merged into
upstream main through cloudflare/vinext#3112 as `2a2ce31`.

closes #2569

Co-authored-by: MK (fengmk2) <fengmk2@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants