mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix(webpack): normalize devtool for terser compatibility (#6566)
This commit is contained in:
parent
257ae2279b
commit
8391753484
@ -439,11 +439,16 @@ export default class WebpackBaseConfig {
|
||||
if (typeof extend === 'function') {
|
||||
const extendedConfig = extend.call(
|
||||
this.builder, config, { loaders: this.loaders, ...this.nuxtEnv }
|
||||
)
|
||||
// Only overwrite config when something is returned for backwards compatibility
|
||||
if (extendedConfig !== undefined) {
|
||||
return extendedConfig
|
||||
) || config
|
||||
|
||||
const pragma = /@|#/
|
||||
const { devtool } = extendedConfig
|
||||
if (typeof devtool === 'string' && pragma.test(devtool)) {
|
||||
extendedConfig.devtool = devtool.replace(pragma, '')
|
||||
consola.warn(`devtool has been normalized to ${extendedConfig.devtool} as webpack documented value`)
|
||||
}
|
||||
|
||||
return extendedConfig
|
||||
}
|
||||
return config
|
||||
}
|
||||
|
2
test/fixtures/with-config/nuxt.config.js
vendored
2
test/fixtures/with-config/nuxt.config.js
vendored
@ -86,7 +86,7 @@ export default {
|
||||
transpile: 'vue-test',
|
||||
extend (config, options) {
|
||||
return Object.assign({}, config, {
|
||||
devtool: '#source-map'
|
||||
devtool: 'source-map'
|
||||
})
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user