diff --git a/packages/webpack/src/config/base.js b/packages/webpack/src/config/base.js index 19f56bf70e31..0a9425b672f3 100644 --- a/packages/webpack/src/config/base.js +++ b/packages/webpack/src/config/base.js @@ -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 } diff --git a/test/fixtures/with-config/nuxt.config.js b/test/fixtures/with-config/nuxt.config.js index 40289390d7eb..d3cd57827ac3 100644 --- a/test/fixtures/with-config/nuxt.config.js +++ b/test/fixtures/with-config/nuxt.config.js @@ -86,7 +86,7 @@ export default { transpile: 'vue-test', extend (config, options) { return Object.assign({}, config, { - devtool: '#source-map' + devtool: 'source-map' }) } },