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

Correctly list unsupported turbopack experimental options #47093

Merged
merged 5 commits into from
Mar 14, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 25 additions & 8 deletions packages/next/src/cli/next-dev.ts
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,12 @@ const nextDev: CliCommand = async (argv) => {
) {
return false
}

// experimental options are checked separately
if (configKey === 'experimental') {
return false
}

let userValue = parentUserConfig?.[configKey]
let defaultValue = parentDefaultConfig?.[configKey]

Expand All @@ -317,9 +323,20 @@ const nextDev: CliCommand = async (argv) => {
}
}

nonSupportedConfig = Object.keys(rawNextConfig).filter((key) =>
checkUnsupportedCustomConfig(key, rawNextConfig, defaultConfig)
)
nonSupportedConfig = [
...Object.keys(rawNextConfig).filter((key) =>
checkUnsupportedCustomConfig(key, rawNextConfig, defaultConfig)
),
...Object.keys(rawNextConfig.experimental)
.filter((key) =>
checkUnsupportedCustomConfig(
key,
rawNextConfig?.experimental,
defaultConfig?.experimental
)
)
.map((key) => `experimental.${key}`),
]
} catch (e) {
console.error('Unexpected error occurred while checking config', e)
}
Expand Down Expand Up @@ -353,13 +370,13 @@ const nextDev: CliCommand = async (argv) => {
unsupportedParts += `\n\n- Unsupported Next.js configuration option(s) (${chalk.cyan(
'next.config.js'
)})\n ${chalk.dim(
`The only configurations options supported are:\n${supportedTurbopackNextConfigOptions
.map((name) => ` - ${chalk.cyan(name)}\n`)
`To use Turbopack, remove the following configuration options:\n${nonSupportedConfig
.map((name) => ` - ${chalk.red(name)}\n`)
.join(
''
)} To use Turbopack, remove the following configuration options:\n${nonSupportedConfig.map(
(name) => ` - ${chalk.red(name)}\n`
)}`
)} The only supported configurations options are:\n${supportedTurbopackNextConfigOptions
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for flipping these.

.map((name) => ` - ${chalk.cyan(name)}\n`)
.join('')} `
)} `
}

Expand Down