Skip to content

Commit a5317ed

Browse files
authored
fix: amp deprecation warning should assert on user config (#82572)
1 parent 756221b commit a5317ed

File tree

2 files changed

+24
-20
lines changed

2 files changed

+24
-20
lines changed

packages/next/src/server/config.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,26 @@ function assignDefaults(
161161
delete userConfig.exportTrailingSlash
162162
}
163163

164+
// There are a good amount of test fixtures that have amp enabled
165+
// that also assert on stderr output being empty, so we're gating the
166+
// warning to be skipped when running in Next.js tests until we fully
167+
// remove the feature.
168+
if (!process.env.__NEXT_TEST_MODE) {
169+
warnOptionHasBeenDeprecated(
170+
userConfig,
171+
'amp',
172+
`Built-in amp support is deprecated and the \`amp\` configuration option will be removed in Next.js 16.`,
173+
silent
174+
)
175+
176+
warnOptionHasBeenDeprecated(
177+
userConfig,
178+
'experimental.amp',
179+
`Built-in amp support is deprecated and the \`experimental.amp\` configuration option will be removed in Next.js 16.`,
180+
silent
181+
)
182+
}
183+
164184
// Handle deprecation of experimental.dynamicIO and migrate to experimental.cacheComponents
165185
if (userConfig.experimental?.dynamicIO !== undefined) {
166186
warnOptionHasBeenDeprecated(
@@ -503,26 +523,6 @@ function assignDefaults(
503523
}
504524
}
505525

506-
// There are a good amount of test fixtures that have amp enabled
507-
// that also assert on stderr output being empty, so we're gating the
508-
// warning to be skipped when running in Next.js tests until we fully
509-
// remove the feature.
510-
if (!process.env.__NEXT_TEST_MODE) {
511-
warnOptionHasBeenDeprecated(
512-
result,
513-
'amp',
514-
`Built-in amp support is deprecated and the \`amp\` configuration option will be removed in Next.js 16.`,
515-
silent
516-
)
517-
518-
warnOptionHasBeenDeprecated(
519-
result,
520-
'experimental.amp',
521-
`Built-in amp support is deprecated and the \`experimental.amp\` configuration option will be removed in Next.js 16.`,
522-
silent
523-
)
524-
}
525-
526526
warnCustomizedOption(
527527
result,
528528
'experimental.esmExternals',

packages/next/src/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,10 @@ export type ResponseLimit = SizeLimit | boolean
114114
* `Config` type, use it for export const config
115115
*/
116116
export type PageConfig = {
117+
/**
118+
* @deprecated built-in amp support will be removed in Next 16
119+
* @see [`next/amp`](https://nextjs.org/docs/api-reference/next/amp)
120+
*/
117121
amp?: boolean | 'hybrid'
118122
api?: {
119123
/**

0 commit comments

Comments
 (0)