fix(webpack): normalize devtool for terser compatibility (#6566)

This commit is contained in:
Xin Du (Clark) 2019-10-19 09:21:42 +01:00 committed by Pooya Parsa
parent 257ae2279b
commit 8391753484
2 changed files with 10 additions and 5 deletions

View File

@ -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
} }

View File

@ -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'
}) })
} }
}, },