Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(webpack): warn when using deprecated build.extend hook #20605

Merged
merged 6 commits into from May 8, 2023
27 changes: 1 addition & 26 deletions packages/webpack/src/utils/config.ts
Expand Up @@ -57,31 +57,6 @@ export function fileName (ctx: WebpackConfigContext, key: string) {
}

export function getWebpackConfig (ctx: WebpackConfigContext): Configuration {
const { options, config } = ctx

// TODO
const builder = {}
const loaders: any[] = []

// @ts-expect-error TODO: remove support for `build.extend` in v3.5
const { extend } = options.build
danielroe marked this conversation as resolved.
Show resolved Hide resolved
if (typeof extend === 'function') {
const extendedConfig = extend.call(
builder,
config,
{ loaders, ...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(config)
return cloneDeep(ctx.config)
}