Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add warning for experimental flags that have moved #44202

Merged
merged 2 commits into from Dec 20, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
36 changes: 36 additions & 0 deletions packages/next/server/config.ts
Expand Up @@ -615,6 +615,42 @@ function assignDefaults(dir: string, userConfig: { [key: string]: any }) {
result.transpilePackages = (result.experimental as any).transpilePackages
}

if (
result.experimental &&
'allowMiddlewareResponseBody' in (result.experimental as any)
) {
Log.warn(
`\`allowMiddlewareResponseBody\` has been moved out of \`experimental\`. Please update your ${configFileName} file accordingly.`
)
result.allowMiddlewareResponseBody = (
result.experimental as any
).allowMiddlewareResponseBody
}

if (
result.experimental &&
'skipMiddlewareUrlNormalize' in (result.experimental as any)
) {
Log.warn(
`\`skipMiddlewareUrlNormalize\` has been moved out of \`experimental\`. Please update your ${configFileName} file accordingly.`
)
result.skipMiddlewareUrlNormalize = (
result.experimental as any
).skipMiddlewareUrlNormalize
}

if (
result.experimental &&
'skipTrailingSlashRedirect' in (result.experimental as any)
) {
Log.warn(
`\`skipTrailingSlashRedirect\` has been moved out of \`experimental\`. Please update your ${configFileName} file accordingly.`
)
result.skipTrailingSlashRedirect = (
result.experimental as any
).skipTrailingSlashRedirect
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In the future, we might want to make a helper function to avoid the boilerplate (keep it DRY)


if (
result.experimental?.outputFileTracingRoot &&
!isAbsolute(result.experimental.outputFileTracingRoot)
Expand Down