fix(webpack): remove legacy support for `build.extend` (#22305)

This commit is contained in:
Daniel Roe 2023-07-24 18:21:28 +01:00 committed by GitHub
parent 54887aa05b
commit 4aadfac631
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 21 deletions

View File

@ -57,27 +57,6 @@ export function fileName (ctx: WebpackConfigContext, key: string) {
}
export function getWebpackConfig (ctx: WebpackConfigContext): Configuration {
// @ts-expect-error TODO: remove support for `build.extend` in v3.6
const { extend } = ctx.options.build
if (typeof extend === 'function') {
logger.warn('[nuxt] The `build.extend` and `webpack.build.extend` properties have been deprecated in Nuxt 3 for some time and will be removed in a future minor release. Instead, you can extend webpack config using the `webpack:config` hook.')
const extendedConfig = extend.call(
{},
ctx.config,
{ loaders: [], ...ctx }
) || ctx.config
const pragma = /@|#/
const { devtool } = extendedConfig
if (typeof devtool === 'string' && pragma.test(devtool)) {
extendedConfig.devtool = devtool.replace(pragma, '')
logger.warn(`devtool has been normalized to ${extendedConfig.devtool} as webpack documented value`)
}
return extendedConfig
}
// Clone deep avoid leaking config between Client and Server
return cloneDeep(ctx.config)
}