Skip to content

Commit

Permalink
Update id config handling (vercel#50847)
Browse files Browse the repository at this point in the history
Adds a separate flag for leveraging the env variable.
  • Loading branch information
ijjk authored and hydRAnger committed Jun 12, 2023
1 parent 0b03b42 commit 30d5377
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
3 changes: 3 additions & 0 deletions packages/next/src/server/config-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,9 @@ const configSchema = {
craCompat: {
type: 'boolean',
},
useDeploymentId: {
type: 'boolean',
},
useDeploymentIdServerActions: {
type: 'boolean',
},
Expand Down
4 changes: 3 additions & 1 deletion packages/next/src/server/config-shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export interface NextJsWebpackConfig {
}

export interface ExperimentalConfig {
useDeploymentId?: boolean
useDeploymentIdServerActions?: boolean
deploymentId?: string
logging?: 'verbose'
Expand Down Expand Up @@ -662,8 +663,9 @@ export const defaultConfig: NextConfig = {
output: !!process.env.NEXT_PRIVATE_STANDALONE ? 'standalone' : undefined,
modularizeImports: undefined,
experimental: {
useDeploymentId: false,
deploymentId: undefined,
useDeploymentIdServerActions: false,
deploymentId: process.env.NEXT_DEPLOYMENT_ID || '',
appDocumentPreloading: undefined,
clientRouterFilter: false,
clientRouterFilterRedirects: false,
Expand Down
8 changes: 8 additions & 0 deletions packages/next/src/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,14 @@ function assignDefaults(
}
}

// only leverage deploymentId
if (result.experimental?.useDeploymentId && process.env.NEXT_DEPLOYMENT_ID) {
if (!result.experimental) {
result.experimental = {}
}
result.experimental.deploymentId = process.env.NEXT_DEPLOYMENT_ID
}

// use the closest lockfile as tracing root
if (!result.experimental?.outputFileTracingRoot) {
let rootDir = findRootDir(dir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ createNextDescribe(
env: {
NEXT_DEPLOYMENT_ID: deploymentId,
},
nextConfig: {
experimental: {
useDeploymentId: true,
},
},
},
({ next }) => {
it.each([
Expand Down

0 comments on commit 30d5377

Please sign in to comment.