File tree 2 files changed +20
-1
lines changed
packages/@vue/cli-service
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,24 @@ test('api: configureWebpack', () => {
140
140
expect ( config . output . path ) . toBe ( 'test-dist-2' )
141
141
} )
142
142
143
+ test ( 'api: configureWebpack returning object' , ( ) => {
144
+ const service = createMockService ( [ {
145
+ id : 'test' ,
146
+ apply : api => {
147
+ api . configureWebpack ( config => {
148
+ return {
149
+ output : {
150
+ path : 'test-dist-3'
151
+ }
152
+ }
153
+ } )
154
+ }
155
+ } ] )
156
+
157
+ const config = service . resolveWebpackConfig ( )
158
+ expect ( config . output . path ) . toBe ( 'test-dist-3' )
159
+ } )
160
+
143
161
test ( 'api: configureDevServer' , ( ) => {
144
162
const cb = ( ) => { }
145
163
const service = createMockService ( [ {
Original file line number Diff line number Diff line change @@ -143,7 +143,8 @@ module.exports = class Service {
143
143
this . webpackRawConfigFns . forEach ( fn => {
144
144
if ( typeof fn === 'function' ) {
145
145
// function with optional return value
146
- config = fn ( config ) || config
146
+ const res = fn ( config )
147
+ if ( res ) config = merge ( config , res )
147
148
} else if ( fn ) {
148
149
// merge literal values
149
150
config = merge ( config , fn )
You can’t perform that action at this time.
0 commit comments