From df51081ad028d846be24a8e692e77d771b21db95 Mon Sep 17 00:00:00 2001 From: Maia Teegarden Date: Wed, 9 Feb 2022 14:02:02 -0800 Subject: [PATCH] Add warnings to update config --- packages/next/server/config.ts | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/packages/next/server/config.ts b/packages/next/server/config.ts index 6a64992688521..04a1727eddf2d 100644 --- a/packages/next/server/config.ts +++ b/packages/next/server/config.ts @@ -365,6 +365,48 @@ function assignDefaults(userConfig: { [key: string]: any }) { result.swcMinify = (result.experimental as any).swcMinify } + if (result.experimental && 'relay' in (result.experimental as any)) { + Log.warn( + `\`relay\` has been moved out of \`experimental\` and into \`compiler\`. Please update your ${configFileName} file accordingly.` + ) + result.compiler = result.compiler || {} + result.compiler.relay = (result.experimental as any).relay + } + + if ( + result.experimental && + 'styledComponents' in (result.experimental as any) + ) { + Log.warn( + `\`styledComponents\` has been moved out of \`experimental\` and into \`compiler\`. Please update your ${configFileName} file accordingly.` + ) + result.compiler = result.compiler || {} + result.compiler.styledComponents = ( + result.experimental as any + ).styledComponents + } + + if ( + result.experimental && + 'reactRemoveProperties' in (result.experimental as any) + ) { + Log.warn( + `\`reactRemoveProperties\` has been moved out of \`experimental\` and into \`compiler\`. Please update your ${configFileName} file accordingly.` + ) + result.compiler = result.compiler || {} + result.compiler.reactRemoveProperties = ( + result.experimental as any + ).reactRemoveProperties + } + + if (result.experimental && 'removeConsole' in (result.experimental as any)) { + Log.warn( + `\`removeConsole\` has been moved out of \`experimental\` and into \`compiler\`. Please update your ${configFileName} file accordingly.` + ) + result.compiler = result.compiler || {} + result.compiler.removeConsole = (result.experimental as any).removeConsole + } + if (result.swcMinify) { Log.warn( 'SWC minify release candidate enabled. https://nextjs.org/docs/messages/swc-minify-enabled'