mirror of
https://github.com/cloudflare/vinext.git
synced 2026-05-09 08:25:34 +02:00
[PR #408] [MERGED] feat: support generateBuildId in next.config and inject build ID at runtime #550
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#550
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/408
Author: @james-elicx
Created: 3/10/2026
Status: ✅ Merged
Merged: 3/10/2026
Merged by: @james-elicx
Base:
main← Head:opencode/lucky-island📝 Commits (6)
04c2f34feat: support generateBuildId in next.config and inject build ID at runtimebaf0c7eregen snaps56d93ferefactor: extract safeUUID helper and drop buildId param from createSSRHandleraaa5089regen snapsa71c0cdfix: stabilize entry-templates snapshot by setting generateBuildId in pages-basic fixture3aaa94cfix: move buildId to NextURL to match Next.js API surface📊 Changes
10 files changed (+208 additions, -2 deletions)
View changed files
📝
packages/vinext/src/build/static-export.ts(+1 -0)📝
packages/vinext/src/config/next-config.ts(+57 -0)📝
packages/vinext/src/entries/pages-server-entry.ts(+7 -1)📝
packages/vinext/src/index.ts(+3 -0)📝
packages/vinext/src/server/dev-server.ts(+1 -0)📝
packages/vinext/src/shims/server.ts(+19 -0)📝
tests/__snapshots__/entry-templates.test.ts.snap(+4 -1)📝
tests/fixtures/pages-basic/next.config.mjs(+1 -0)📝
tests/next-config.test.ts(+69 -0)📝
tests/shims.test.ts(+46 -0)📄 Description
Summary
generateBuildIdsupport tonext.config— calls the function at build/dev start, falls back to a random UUID (ad-blocker-safe, no "ad" substring) when not provided or when the function returnsnullprocess.env.__VINEXT_BUILD_IDvia Vitedefineso it's available at runtime across all environmentsbuildIdin__NEXT_DATA__for Pages Router (dev server, production server, and static export)NextRequest.buildIdaccessor in thenext/servershim for deployment-skew detection in middlewaregenerateBuildId did not return a string,generateBuildId returned an empty string)Tests
10 new tests in
tests/next-config.test.ts(ported from the Next.js integration test suite), 2 new tests intests/shims.test.ts— all passing.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.