Skip to content
Closed
Changes from all commits
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
19 changes: 8 additions & 11 deletions packages/next/src/lib/turbopack-warning.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,22 +164,19 @@ export async function validateTurboNextConfig({
// configuration. Otherwise the user explicitly picked turbopack and thus we expect that
// they have configured it correctly.
if (process.env.TURBOPACK === 'auto' && hasWebpackConfig && !hasTurboConfig) {
const logMethod = isDev ? Log.warn : Log.error
// In a production build with auto-detected Turbopack, we want to fail the build.
logMethod(
// If we defaulted to Turbopack, we want to fail the build to avoid surprising developers upgrading.
// This can be removed in a future release.
Log.error(
`Webpack is configured while Turbopack is not. This may be a mistake.`
)
logMethod(
`To configure Turbopack, see:\n https://nextjs.org/docs/app/api-reference/next-config-js/turbopack`
Log.error(
`To configure Turbopack, see https://nextjs.org/docs/app/api-reference/next-config-js/turbopack`
)
logMethod(
`TIP: Silence this ${isDev ? 'warning' : 'error'} by passing the --turbopack or --webpack flag explicitly.`
Log.error(
`TIP: Silence this by passing the --turbopack or --webpack flag explicitly.`
)

// For production builds we want to simply fail to prevent accidental misconfiguration.
if (!isDev) {
process.exit(1)
}
process.exit(1)
}

if (unsupportedConfig.length) {
Expand Down
Loading