mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-11 19:28:05 +00:00
Change build.extend hook to return new webpack config
This commit is contained in:
parent
635ee580e9
commit
8cf5a21752
@ -220,10 +220,14 @@ export default function webpackClientConfig () {
|
|||||||
|
|
||||||
// Extend config
|
// Extend config
|
||||||
if (typeof this.options.build.extend === 'function') {
|
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,
|
dev: this.options.dev,
|
||||||
isClient: true
|
isClient: true
|
||||||
})
|
})
|
||||||
|
// Only overwrite config when something is returned for backwards compatibility
|
||||||
|
if (extendedConfig !== undefined) {
|
||||||
|
config = extendedConfig
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
@ -74,10 +74,14 @@ export default function webpackServerConfig () {
|
|||||||
|
|
||||||
// Extend config
|
// Extend config
|
||||||
if (typeof this.options.build.extend === 'function') {
|
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,
|
dev: this.options.dev,
|
||||||
isServer: true
|
isServer: true
|
||||||
})
|
})
|
||||||
|
// Only overwrite config when something is returned for backwards compatibility
|
||||||
|
if (extendedConfig !== undefined) {
|
||||||
|
config = extendedConfig
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return config
|
return config
|
||||||
|
4
test/fixtures/with-config/nuxt.config.js
vendored
4
test/fixtures/with-config/nuxt.config.js
vendored
@ -34,7 +34,9 @@ module.exports = {
|
|||||||
generateStatsFile: true
|
generateStatsFile: true
|
||||||
},
|
},
|
||||||
extend (config, options) {
|
extend (config, options) {
|
||||||
config.devtool = 'nosources-source-map'
|
return Object.assign({}, config, {
|
||||||
|
devtool: 'nosources-source-map'
|
||||||
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
css: [
|
css: [
|
||||||
|
Loading…
Reference in New Issue
Block a user