Unverified Commit 2bca1fde authored by Zack Tanner's avatar Zack Tanner Committed by GitHub

[Deprecation Warnings]: add amp deprecation warning (#82551)

We are dropping amp support in an upcoming major. This adds a warning
for using these configuration options and updates the docs with the
warning.

---------
Co-authored-by: 's avatarSebastian "Sebbie" Silbermann <sebastian.silbermann@vercel.com>
parent 7f20cbd6
...@@ -11,6 +11,8 @@ description: With minimal config, and without leaving React, you can start addin ...@@ -11,6 +11,8 @@ description: With minimal config, and without leaving React, you can start addin
</details> </details>
> **Warning**: Built-in amp support will be removed in Next.js 16.
With Next.js you can turn any React page into an AMP page, with minimal config, and without leaving React. With Next.js you can turn any React page into an AMP page, with minimal config, and without leaving React.
You can read more about AMP in the official [amp.dev](https://amp.dev/) site. You can read more about AMP in the official [amp.dev](https://amp.dev/) site.
......
...@@ -500,6 +500,7 @@ export interface ExperimentalConfig { ...@@ -500,6 +500,7 @@ export interface ExperimentalConfig {
nextScriptWorkers?: boolean nextScriptWorkers?: boolean
scrollRestoration?: boolean scrollRestoration?: boolean
externalDir?: boolean externalDir?: boolean
/** @deprecated built-in amp support will be removed in Next 16 */
amp?: { amp?: {
optimizer?: any optimizer?: any
validator?: string validator?: string
...@@ -1146,7 +1147,10 @@ export interface NextConfig extends Record<string, any> { ...@@ -1146,7 +1147,10 @@ export interface NextConfig extends Record<string, any> {
pagesBufferLength?: number pagesBufferLength?: number
} }
/** @see [`next/amp`](https://nextjs.org/docs/api-reference/next/amp) */ /**
* @deprecated built-in amp support will be removed in Next 16
* @see [`next/amp`](https://nextjs.org/docs/api-reference/next/amp)
*/
amp?: { amp?: {
canonicalBase?: string canonicalBase?: string
} }
......
...@@ -503,6 +503,26 @@ function assignDefaults( ...@@ -503,6 +503,26 @@ 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',
......
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