next.js
87a8fb2f - Fix preview version in `window.next.version` for PR builds (#90937)

Commit
148 days ago
Fix preview version in `window.next.version` for PR builds (#90937) Preview builds served via `vercel-packages.vercel.app` were showing the published canary version instead of the PR-specific preview version. This happened because `create-preview-tarballs.js` updated `package.json` after the build, but the version was already baked into the compiled `dist/` files by `setNextVersion` in `taskfile-swc.js`. This extracts the version computation from `create-preview-tarballs.js` into a new `set-preview-version.js` script that runs before `pnpm run build`, so the compiled output naturally includes the correct version. `create-preview-tarballs.js` now reads the version from `packages/next/package.json` instead of computing it independently. ## Test Plan 1. Create a new app: `pnpm create next-app@canary` 2. Install the preview build from this PR: `pnpm i https://vercel-packages.vercel.app/next/commits/06681c21e886a97e39d277808780884151c00318/next` 3. Run `pnpm dev` and inspect `next.version` in DevTools — should show `16.2.0-preview-06681c21-20260306` instead of the canary version
Author
Parents
Loading