diff --git a/packages/next/src/build/webpack/plugins/define-env-plugin.ts b/packages/next/src/build/webpack/plugins/define-env-plugin.ts index b4f5a3e230dab..1a3cdf834291f 100644 --- a/packages/next/src/build/webpack/plugins/define-env-plugin.ts +++ b/packages/next/src/build/webpack/plugins/define-env-plugin.ts @@ -288,6 +288,8 @@ export function getDefineEnv({ needsExperimentalReact(config), } : undefined), + 'process.env.__NEXT_EXPERIMENTAL_NEW_DEV_OVERLAY': + config.experimental.newDevOverlay ?? false, } const userDefines = config.compiler?.define ?? {} diff --git a/packages/next/src/server/config-schema.ts b/packages/next/src/server/config-schema.ts index d1f20739ecc7a..5a4c5c39915bd 100644 --- a/packages/next/src/server/config-schema.ts +++ b/packages/next/src/server/config-schema.ts @@ -439,6 +439,7 @@ export const configSchema: zod.ZodType = z.lazy(() => typedEnv: z.boolean().optional(), serverComponentsHmrCache: z.boolean().optional(), authInterrupts: z.boolean().optional(), + newDevOverlay: z.boolean().optional(), }) .optional(), exportPathMap: z diff --git a/packages/next/src/server/config-shared.ts b/packages/next/src/server/config-shared.ts index 8adfefc99dda7..026f9c93fee64 100644 --- a/packages/next/src/server/config-shared.ts +++ b/packages/next/src/server/config-shared.ts @@ -562,6 +562,11 @@ export interface ExperimentalConfig { * This config allows you to enable the experimental navigation API `forbidden` and `unauthorized`. */ authInterrupts?: boolean + + /** + * Enables the new dev overlay. + */ + newDevOverlay?: boolean } export type ExportPathMap = { @@ -1163,6 +1168,7 @@ export const defaultConfig: NextConfig = { staticGenerationMinPagesPerWorker: 25, dynamicIO: false, inlineCss: false, + newDevOverlay: false, }, bundlePagesRouterDependencies: false, }