From c09862b03a60d872d76f34fc4005e3de9cecb210 Mon Sep 17 00:00:00 2001 From: Tim Neutkens Date: Thu, 28 Mar 2024 16:08:39 +0100 Subject: [PATCH] Ensure Webpack config shows a warning when using Turbopack --- packages/next/src/lib/turbopack-warning.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/next/src/lib/turbopack-warning.ts b/packages/next/src/lib/turbopack-warning.ts index 46356f012e980..4185626646493 100644 --- a/packages/next/src/lib/turbopack-warning.ts +++ b/packages/next/src/lib/turbopack-warning.ts @@ -93,8 +93,8 @@ export async function validateTurboNextConfig({ let babelrc = await getBabelConfigFile(dir) if (babelrc) babelrc = path.basename(babelrc) - let hasWebpack = false - let hasTurbo = !!process.env.TURBOPACK + let hasWebpackConfig = false + let hasTurboConfig = false let unsupportedConfig: string[] = [] let rawNextConfig: NextConfig = {} @@ -154,10 +154,10 @@ export async function validateTurboNextConfig({ for (const key of customKeys) { if (key.startsWith('webpack')) { - hasWebpack = true + hasWebpackConfig = true } if (key.startsWith('experimental.turbo')) { - hasTurbo = true + hasTurboConfig = true } let isUnsupported = @@ -187,12 +187,12 @@ export async function validateTurboNextConfig({ 'https://nextjs.link/with-turbopack' )}\n` - if (hasWebpack && !hasTurbo) { + if (hasWebpackConfig && !hasTurboConfig) { Log.warn( `Webpack is configured while Turbopack is not, which may cause problems.` ) Log.warn( - `See instructions if you need to configure Turbopack:\n https://turbo.build/pack/docs/features/customizing-turbopack\n` + `See instructions if you need to configure Turbopack:\n https://nextjs.org/docs/app/api-reference/next-config-js/turbo\n` ) }