From 9c7e8b661c99bd39aa315a705ae4e1ae38ac2457 Mon Sep 17 00:00:00 2001 From: Steven Date: Sat, 22 Oct 2022 21:11:56 -0400 Subject: [PATCH] Remove deprecated `webpack5` config option (#41667) This option doesn't do anything except print an error since Next.js 12, so we can remove it. See previous upgrade guide: https://github.com/vercel/next.js/blob/canary/docs/upgrading.md#upgrade-nextjs-version-to-12 --- packages/next/server/config-schema.ts | 5 ----- packages/next/server/config-shared.ts | 14 -------------- packages/next/server/config.ts | 6 ------ 3 files changed, 25 deletions(-) diff --git a/packages/next/server/config-schema.ts b/packages/next/server/config-schema.ts index eeb8b94d6b01..c6460aacec82 100644 --- a/packages/next/server/config-schema.ts +++ b/packages/next/server/config-schema.ts @@ -439,11 +439,6 @@ const configSchema = { isFunction: true, errorMessage: 'must be a function that returns a Promise', } as any, - future: { - additionalProperties: false, - properties: {}, - type: 'object', - }, generateBuildId: { isFunction: true, errorMessage: 'must be a function that returns a Promise', diff --git a/packages/next/server/config-shared.ts b/packages/next/server/config-shared.ts index 9e81357dab70..de58b999d6bc 100644 --- a/packages/next/server/config-shared.ts +++ b/packages/next/server/config-shared.ts @@ -233,12 +233,6 @@ export interface NextConfig extends Record { */ redirects?: () => Promise - /** - * @deprecated This option has been removed as webpack 5 is now default - * @see [Next.js webpack 5 documentation](https://nextjs.org/docs/messages/webpack5) for upgrading guidance. - */ - webpack5?: false - /** * @see [Moment.js locales excluded by default](https://nextjs.org/docs/upgrading#momentjs-locales-excluded-by-default) */ @@ -405,13 +399,6 @@ export interface NextConfig extends Record { */ httpAgentOptions?: { keepAlive?: boolean } - future?: { - /** - * @deprecated This option has been removed as webpack 5 is now default - */ - webpack5?: false - } - /** * During a build, Next.js will automatically trace each page and its dependencies to determine all of the files * that are needed for deploying a production version of your application. @@ -539,7 +526,6 @@ export const defaultConfig: NextConfig = { i18n: null, productionBrowserSourceMaps: false, optimizeFonts: true, - webpack5: undefined, excludeDefaultMomentLocales: true, serverRuntimeConfig: {}, publicRuntimeConfig: {}, diff --git a/packages/next/server/config.ts b/packages/next/server/config.ts index 2a3d9de91742..eccec7a6e77f 100644 --- a/packages/next/server/config.ts +++ b/packages/next/server/config.ts @@ -520,12 +520,6 @@ function assignDefaults(dir: string, userConfig: { [key: string]: any }) { } } - if (result.webpack5 === false) { - throw new Error( - `Webpack 4 is no longer supported in Next.js. Please upgrade to webpack 5 by removing "webpack5: false" from ${configFileName}. https://nextjs.org/docs/messages/webpack5` - ) - } - 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.`