Files
Niklas MischkulnigandGitHub 0aac540416 Replace flight navigation build id field with header (#88855)
Closes PACK-6536

- with deployment id available: a header contains the process.env.NEXT_DEPLOYMENT_ID , the client knows its dpl id already, so we can use that already
- with deployment id unavailable: a response field contains the BUILD_ID, keep the existing logic of storing the build id in the browser

It's unfortunate that we have to keep the BUILD_ID response field approach as a fallback, but oh well.
This has the benefit that we won't need the build id anymore when the deployment id is available.

If you use `output:export` and set `config.deploymentId` (i.e. enable skew protection) you are still expected to set these headers.

---

- [x] Fallback behavior for when there is no deployment id
- [ ] Run deployment tests
2026-02-03 14:23:14 +01:00

20 lines
414 B
JavaScript

const buildId = process.env.NEXT_PUBLIC_BUILD_ID
if (!buildId && !process.env.NEXT_DEPLOYMENT_ID) {
throw new Error('Neither NEXT_PUBLIC_BUILD_ID nor NEXT_DEPLOYMENT_ID is set')
}
/**
* @type {import('next').NextConfig}
*/
const nextConfig = {
distDir: '.next' + (process.env.DIST_DIR || ''),
generateBuildId:
buildId &&
(async () => {
return buildId
}),
}
module.exports = nextConfig