Skip to content

Commit

Permalink
Add warning for experimental flags that have moved (#44202)
Browse files Browse the repository at this point in the history
These options have been moved out of `experimental`.

## Bug

- [ ] Related issues linked using `fixes #number`
- [ ] Integration tests added
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Feature

- [ ] Implements an existing feature request or RFC. Make sure the feature request has been accepted for implementation before opening a PR.
- [ ] Related issues linked using `fixes #number`
- [ ] [e2e](https://github.com/vercel/next.js/blob/canary/contributing/core/testing.md#writing-tests-for-nextjs) tests added
- [ ] Documentation added
- [ ] Telemetry added. In case of a feature if it's used or not.
- [ ] Errors have a helpful link attached, see [`contributing.md`](https://github.com/vercel/next.js/blob/canary/contributing.md)

## Documentation / Examples

- [ ] Make sure the linting passes by running `pnpm build && pnpm lint`
- [ ] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md)
  • Loading branch information
shuding committed Dec 20, 2022
1 parent e847b49 commit 186e25f
Showing 1 changed file with 36 additions and 0 deletions.
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
}

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

0 comments on commit 186e25f

Please sign in to comment.