Skip to content

perf:document only router runtime#2492

Open
TheAlexLichter wants to merge 8 commits into
mainfrom
perf/document-only-router-runtime
Open

perf:document only router runtime#2492
TheAlexLichter wants to merge 8 commits into
mainfrom
perf/document-only-router-runtime

Conversation

@TheAlexLichter

@TheAlexLichter TheAlexLichter commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

This PR omits the heavy App Router client runtime in production builds when build-time client-reference analysis proves no user client component needs router state.

It rewrites next/link client references to a lightweight document-navigation shim in that case, while conservatively falling back to the full runtime for:

  • pages,
  • i18n,
  • instrumentation,
  • server actions,
  • external/unknown graph edges,
  • next/navigation usage

Note: This only helps apps with client islands that do not pull in next/link, next/form, router hooks, next/router, etc. So “static page plus isolated widgets” benefit from this change.

@pkg-pr-new

pkg-pr-new Bot commented Jul 2, 2026

Copy link
Copy Markdown

Open in StackBlitz

npm i https://pkg.pr.new/@vinext/cloudflare@2492
npm i https://pkg.pr.new/vinext@2492

commit: e85ef72

@github-actions

github-actions Bot commented Jul 2, 2026

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
web preview production

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Performance benchmarks

Compared e85ef72 against base 6c7b71e using alternating same-runner rounds. Next.js was unchanged and skipped.

0 improved · 1 regressed · 5 within ±1.5%

Scenario Framework Baseline Current Change
Client bundle size (gzip) vinext 126.3 KB 126.4 KB ⚫ +0.1%
Client entry size (gzip) vinext 120.4 KB 120.5 KB ⚫ +0.1%
Dev server cold start vinext 2.62 s 2.60 s ⚫ -0.8%
Production build time vinext 3.13 s 3.19 s 🔴 +1.9%
RSC entry closure size (gzip) vinext 97.9 KB 98.0 KB ⚫ +0.1%
Server bundle size (gzip) vinext 164.4 KB 164.5 KB ⚫ +0.1%

View detailed results and traces

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

@TheAlexLichter TheAlexLichter changed the title Perf/document only router runtime perf:document only router runtime Jul 3, 2026
@TheAlexLichter TheAlexLichter marked this pull request as ready for review July 3, 2026 10:20
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.

1 participant