mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #274] [CLOSED] feat: static pre-rendering at build time #433
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#433
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/274
Author: @NathanDrake2406
Created: 3/5/2026
Status: ❌ Closed
Base:
main← Head:feat/static-prerender-build📝 Commits (10+)
5e56610feat: wire output: 'export' to vinext build2149bedfeat: add prerenderStaticPages() for build-time pre-renderingbbcf6e4feat: serve pre-rendered HTML from prod serverf44f446feat: wire prerenderStaticPages() into vinext build1b8a0f9fix: address 6 bugs found in code reviewdf3830ffix: downgrade missing generateStaticParams/getStaticPaths from error to warningce830adfix: address code review findings in static export5be5d1crefactor: improve observability and type safety in static export69a5835fix: address 5 issues from code review audit0ad2979merge: resolve conflict with upstream/main📊 Changes
20 files changed (+1723 additions, -166 deletions)
View changed files
📝
packages/vinext/src/build/report.ts(+76 -9)📝
packages/vinext/src/build/static-export.ts(+808 -133)📝
packages/vinext/src/cli.ts(+91 -1)📝
packages/vinext/src/entries/pages-server-entry.ts(+5 -8)📝
packages/vinext/src/server/prod-server.ts(+111 -0)📝
pnpm-lock.yaml(+21 -0)📝
tests/__snapshots__/entry-templates.test.ts.snap(+2 -8)📝
tests/app-router.test.ts(+4 -6)➕
tests/build-prerender.test.ts(+272 -0)➕
tests/build-static-export.test.ts(+222 -0)➕
tests/fixtures/app-basic/app/empty-gsp/[slug]/page.tsx(+9 -0)➕
tests/fixtures/hybrid-basic/app/about/page.tsx(+8 -0)➕
tests/fixtures/hybrid-basic/app/layout.tsx(+13 -0)➕
tests/fixtures/hybrid-basic/app/page.tsx(+8 -0)➕
tests/fixtures/hybrid-basic/package.json(+13 -0)➕
tests/fixtures/hybrid-basic/pages/legacy.tsx(+8 -0)➕
tests/fixtures/hybrid-basic/tsconfig.json(+12 -0)➕
tests/fixtures/hybrid-basic/vite.config.ts(+6 -0)📝
tests/pages-router.test.ts(+34 -0)📝
tests/static-export.test.ts(+0 -1)📄 Description
Summary
Implements build-time static pre-rendering for vinext, closing #9.
vinext buildwithoutput: "export"now runs full static export toout/(Phase 1)vinext buildin normal mode pre-renders static pages todist/server/pages/(Phase 2)vinext startrejects export builds with a helpful error messagePhase 1:
output: "export"supportAdds
runStaticExport()orchestrator that connects the existingstaticExportPages/staticExportAppfunctions to the CLI build pipeline. Loads config, detects router type, starts a temp dev server, scans routes, renders all static pages toout/.Phase 2: Selective pre-rendering in normal builds
Adds
prerenderStaticPages()that runs after production builds:getServerSideProps,force-dynamic, etc.)dist/server/pages/Files changed
packages/vinext/src/build/static-export.tsrunStaticExport(),prerenderStaticPages(),collectStaticRoutes()packages/vinext/src/cli.tsbuildApp(), export build rejection instart()packages/vinext/src/server/prod-server.tsresolvePrerenderedHtml()+ pre-render serving in both router handlerstests/build-static-export.test.tsrunStaticExport()(both routers)tests/build-prerender.test.tsprerenderStaticPages()Test plan
pnpm run typecheckpassespnpm run lintpassesCloses #9
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.