Skip to content

fix: skip standalone output on Vercel (missing next-server.js.nft.json) - #207

Closed
ulifehacker wants to merge 1 commit into
u14app:mainfrom
bluesky4485:fix/vercel-standalone-output
Closed

fix: skip standalone output on Vercel (missing next-server.js.nft.json)#207
ulifehacker wants to merge 1 commit into
u14app:mainfrom
bluesky4485:fix/vercel-standalone-output

Conversation

@ulifehacker

Copy link
Copy Markdown

Summary

Test Plan

  • pnpm check:imports
  • pnpm format:check
  • pnpm hygiene:artifacts - the script itself crashes on Windows (new URL(...).pathname yields C:\C:\...); verified manually that public/ contains no blocked artifacts. Can send a separate one-line fix if useful.
  • pnpm lint
  • pnpm typecheck
  • pnpm test - 397/399 files pass; the 3 workerSize.test.ts cases fail on Windows with spawn EINVAL (Node 24 refuses .cmd shims), unrelated to this change.
  • pnpm test:e2e
  • pnpm build - verified locally on Windows with the OpenNext dev init temporarily stubbed (workerd cannot start natively on Windows); .next/standalone/ is still emitted when VERCEL is unset, so the Docker path is unchanged.
  • pnpm build:worker
  • pnpm worker:size
  • pnpm worker:dry-run
  • pnpm audit --prod --audit-level moderate

Notes

  • I updated docs or examples when behavior changed.
  • I considered local-first data handling and hosted deployment safety.
  • I added or updated tests for user-facing or security-sensitive changes (env governance registry; the change itself is build-time configuration covered by pnpm build).
  • For localization changes, I followed docs/localization-pr-guide.md and documented intentional English fallbacks. (no localization changes)

Vercel's Next build adapter reads .next/next-server.js.nft.json during
onBuildComplete, which standalone builds do not emit, so next@16.3+
deployments crash at the packaging step. Keep the standard output on
Vercel (detected via the platform-injected VERCEL=1) while Docker and
self-hosted builds continue to use standalone, with the new build-time
NEXT_OUTPUT_MODE variable as an explicit override. Document both
variables and register them in the env governance test.
@Amery2010

Copy link
Copy Markdown
Collaborator

While the issue can be bypassed using the standard VERCEL=1 environment, upgrading to Next.js 16.3.5 is a more complete and superior solution.

Thank you for the new feedback, I have already fixed this in the latest version, v2.5.2.

@Amery2010 Amery2010 closed this Sep 13, 2026
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.

3 participants