Skip to content

Commit

Permalink
Only log experiments warning if user actually opted in to an experime…
Browse files Browse the repository at this point in the history
…nt(s) (#34413)

Currently if you have a Next config like the following:

```js
module.exports = {
  experimental: {},
},
```

You are presented with the warning for experimental features, even though you haven't actually enabled any experiments. This PR checks there's at least one key in the `experimental` object before logging the warning.
  • Loading branch information
sophiabits committed Feb 17, 2022
1 parent 0b95da5 commit d4bef88
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/next/server/config.ts
Expand Up @@ -67,8 +67,9 @@ function assignDefaults(userConfig: { [key: string]: any }) {

if (
key === 'experimental' &&
value !== undefined &&
value !== defaultConfig[key]
value !== defaultConfig[key] &&
typeof value === 'object' &&
Object.keys(value).length > 0
) {
experimentalWarning()
}
Expand Down

0 comments on commit d4bef88

Please sign in to comment.