Change build.extend hook to return new webpack config

This commit is contained in:
Ivan Nikulin 2017-08-21 22:21:16 +02:00
parent 635ee580e9
commit 8cf5a21752
No known key found for this signature in database
GPG Key ID: F800F559F11A1A10
3 changed files with 13 additions and 3 deletions

View File

@ -220,10 +220,14 @@ export default function webpackClientConfig () {
// Extend config
if (typeof this.options.build.extend === 'function') {
this.options.build.extend.call(this, config, {
const extendedConfig = this.options.build.extend.call(this, config, {
dev: this.options.dev,
isClient: true
})
// Only overwrite config when something is returned for backwards compatibility
if (extendedConfig !== undefined) {
config = extendedConfig
}
}
return config

View File

@ -74,10 +74,14 @@ export default function webpackServerConfig () {
// Extend config
if (typeof this.options.build.extend === 'function') {
this.options.build.extend.call(this, config, {
const extendedConfig = this.options.build.extend.call(this, config, {
dev: this.options.dev,
isServer: true
})
// Only overwrite config when something is returned for backwards compatibility
if (extendedConfig !== undefined) {
config = extendedConfig
}
}
return config

View File

@ -34,7 +34,9 @@ module.exports = {
generateStatsFile: true
},
extend (config, options) {
config.devtool = 'nosources-source-map'
return Object.assign({}, config, {
devtool: 'nosources-source-map'
})
}
},
css: [