mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 09:27:13 +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') {
|
if (typeof extend === 'function') {
|
||||||
const extendedConfig = extend.call(
|
const extendedConfig = extend.call(
|
||||||
this.builder, config, { loaders: this.loaders, ...this.nuxtEnv }
|
this.builder, config, { loaders: this.loaders, ...this.nuxtEnv }
|
||||||
)
|
) || config
|
||||||
// Only overwrite config when something is returned for backwards compatibility
|
|
||||||
if (extendedConfig !== undefined) {
|
const pragma = /@|#/
|
||||||
return extendedConfig
|
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
|
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',
|
transpile: 'vue-test',
|
||||||
extend (config, options) {
|
extend (config, options) {
|
||||||
return Object.assign({}, config, {
|
return Object.assign({}, config, {
|
||||||
devtool: '#source-map'
|
devtool: 'source-map'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user