mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-16 13:48:13 +00:00
fix(webpack): remove legacy support for build.extend
(#22305)
This commit is contained in:
parent
54887aa05b
commit
4aadfac631
@ -57,27 +57,6 @@ export function fileName (ctx: WebpackConfigContext, key: string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getWebpackConfig (ctx: WebpackConfigContext): Configuration {
|
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
|
// Clone deep avoid leaking config between Client and Server
|
||||||
return cloneDeep(ctx.config)
|
return cloneDeep(ctx.config)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user