diff --git a/packages/next/src/server/config-schema.ts b/packages/next/src/server/config-schema.ts index 33e63cfcf0a84d..6376d377eed7c5 100644 --- a/packages/next/src/server/config-schema.ts +++ b/packages/next/src/server/config-schema.ts @@ -231,14 +231,6 @@ export const configSchema: zod.ZodType = z.lazy(() => .object({ appIsrStatus: z.boolean().optional(), buildActivity: z.boolean().optional(), - buildActivityPosition: z - .union([ - z.literal('bottom-left'), - z.literal('bottom-right'), - z.literal('top-left'), - z.literal('top-right'), - ]) - .optional(), position: z .union([ z.literal('bottom-left'), diff --git a/packages/next/src/server/config-shared.ts b/packages/next/src/server/config-shared.ts index eed5c0100d140e..9b1f2ad61d9ec6 100644 --- a/packages/next/src/server/config-shared.ts +++ b/packages/next/src/server/config-shared.ts @@ -837,11 +837,17 @@ export interface NextConfig extends Record { /** Configure indicators in development environment */ devIndicators?: { + /** + * @deprecated The dev tools indicator has it enabled by default. + * */ + appIsrStatus?: boolean + /** * Show "building..."" indicator in development * @deprecated The dev tools indicator has it enabled by default. */ buildActivity?: boolean + /** * Position of "building..." indicator in browser * @deprecated Renamed as `position`. @@ -852,13 +858,10 @@ export interface NextConfig extends Record { | 'top-right' | 'top-left' - /** Position of "building..." indicator in browser */ - position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' - /** - * @deprecated The dev tools indicator has it enabled by default. + * Position of "building..." indicator in browser * */ - appIsrStatus?: boolean + position?: 'bottom-right' | 'bottom-left' | 'top-right' | 'top-left' } /** @@ -1104,8 +1107,7 @@ export const defaultConfig: NextConfig = { compress: true, images: imageConfigDefault, devIndicators: { - buildActivityPosition: 'bottom-right', - position: 'bottom-right', + position: 'bottom-left', }, onDemandEntries: { maxInactiveAge: 60 * 1000, diff --git a/packages/next/src/server/config.ts b/packages/next/src/server/config.ts index 5a948c83e3f755..f3c91783764b3f 100644 --- a/packages/next/src/server/config.ts +++ b/packages/next/src/server/config.ts @@ -55,7 +55,8 @@ export function warnOptionHasBeenDeprecated( nestedPropertyKey: string, reason: string, silent: boolean -) { +): boolean { + let hasWarned = false if (!silent) { let current = config let found = true @@ -69,9 +70,11 @@ export function warnOptionHasBeenDeprecated( } } if (found) { - Log.warn(reason) + Log.warnOnce(reason) + hasWarned = true } } + return hasWarned } export function warnOptionHasBeenMovedOutOfExperimental( @@ -111,7 +114,7 @@ export function warnOptionHasBeenRenamed( ) { if (config[oldKey]) { if (!silent) { - Log.warn( + Log.warnOnce( `\`${oldKey}\` has been renamed to \`${newKey}\`. ` + `Please update your ${configFileName} file accordingly.` ) @@ -505,22 +508,20 @@ function assignDefaults( silent ) - warnOptionHasBeenRenamed( + const hasWarnedBuildActivityPosition = warnOptionHasBeenDeprecated( result, 'devIndicators.buildActivityPosition', - 'devIndicators.position', - configFileName, + `\`devIndicators.buildActivityPosition\` has been renamed to \`devIndicators.position\`. Please update your ${configFileName} file accordingly.`, silent ) - - if (result.devIndicators?.buildActivityPosition) { - if (result.devIndicators.position) { - Log.warn( - `\`devIndicators.buildActivityPosition\` is conflicting with \`devIndicators.position\`. \`devIndicators.position\` will take precedence.` - ) - } else { - result.devIndicators.position = result.devIndicators.buildActivityPosition - } + if ( + hasWarnedBuildActivityPosition && + result.devIndicators?.buildActivityPosition && + result.devIndicators.buildActivityPosition !== result.devIndicators.position + ) { + Log.warnOnce( + `The \`devIndicators\` option \`buildActivityPosition\` ("${result.devIndicators.buildActivityPosition}") conflicts with \`position\` ("${result.devIndicators.position}"). Using \`buildActivityPosition\` for backwardscompatibility.` + ) } warnOptionHasBeenMovedOutOfExperimental( @@ -984,9 +985,10 @@ function assignDefaults( if (process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY === 'false') { result.experimental.newDevOverlay = false } + // Preserve the default indicator options for old overlay. if (result.experimental.newDevOverlay !== true) { - // Preserve the default indicator options for old overlay. result.devIndicators = { + ...result.devIndicators, appIsrStatus: result.devIndicators?.appIsrStatus ?? true, buildActivity: result.devIndicators?.buildActivity ?? true, }