Unverified Commit a5317ed6 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

fix: amp deprecation warning should assert on user config (#82572)

parent 756221bb
...@@ -161,6 +161,26 @@ function assignDefaults( ...@@ -161,6 +161,26 @@ function assignDefaults(
delete userConfig.exportTrailingSlash delete userConfig.exportTrailingSlash
} }
// There are a good amount of test fixtures that have amp enabled
// that also assert on stderr output being empty, so we're gating the
// warning to be skipped when running in Next.js tests until we fully
// remove the feature.
if (!process.env.__NEXT_TEST_MODE) {
warnOptionHasBeenDeprecated(
userConfig,
'amp',
`Built-in amp support is deprecated and the \`amp\` configuration option will be removed in Next.js 16.`,
silent
)
warnOptionHasBeenDeprecated(
userConfig,
'experimental.amp',
`Built-in amp support is deprecated and the \`experimental.amp\` configuration option will be removed in Next.js 16.`,
silent
)
}
// Handle deprecation of experimental.dynamicIO and migrate to experimental.cacheComponents // Handle deprecation of experimental.dynamicIO and migrate to experimental.cacheComponents
if (userConfig.experimental?.dynamicIO !== undefined) { if (userConfig.experimental?.dynamicIO !== undefined) {
warnOptionHasBeenDeprecated( warnOptionHasBeenDeprecated(
...@@ -503,26 +523,6 @@ function assignDefaults( ...@@ -503,26 +523,6 @@ function assignDefaults(
} }
} }
// There are a good amount of test fixtures that have amp enabled
// that also assert on stderr output being empty, so we're gating the
// warning to be skipped when running in Next.js tests until we fully
// remove the feature.
if (!process.env.__NEXT_TEST_MODE) {
warnOptionHasBeenDeprecated(
result,
'amp',
`Built-in amp support is deprecated and the \`amp\` configuration option will be removed in Next.js 16.`,
silent
)
warnOptionHasBeenDeprecated(
result,
'experimental.amp',
`Built-in amp support is deprecated and the \`experimental.amp\` configuration option will be removed in Next.js 16.`,
silent
)
}
warnCustomizedOption( warnCustomizedOption(
result, result,
'experimental.esmExternals', 'experimental.esmExternals',
......
...@@ -114,6 +114,10 @@ export type ResponseLimit = SizeLimit | boolean ...@@ -114,6 +114,10 @@ export type ResponseLimit = SizeLimit | boolean
* `Config` type, use it for export const config * `Config` type, use it for export const config
*/ */
export type PageConfig = { export type PageConfig = {
/**
* @deprecated built-in amp support will be removed in Next 16
* @see [`next/amp`](https://nextjs.org/docs/api-reference/next/amp)
*/
amp?: boolean | 'hybrid' amp?: boolean | 'hybrid'
api?: { api?: {
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment