mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-06 21:10:38 +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
|
||||
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
|
||||
|
@ -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
|
||||
|
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
|
||||
},
|
||||
extend (config, options) {
|
||||
config.devtool = 'nosources-source-map'
|
||||
return Object.assign({}, config, {
|
||||
devtool: 'nosources-source-map'
|
||||
})
|
||||
}
|
||||
},
|
||||
css: [
|
||||
|
Loading…
Reference in New Issue
Block a user