File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed
packages/@vue/cli-service Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,24 @@ test('api: configureWebpack', () => {
140140 expect ( config . output . path ) . toBe ( 'test-dist-2' )
141141} )
142142
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+
143161test ( 'api: configureDevServer' , ( ) => {
144162 const cb = ( ) => { }
145163 const service = createMockService ( [ {
Original file line number Diff line number Diff line change @@ -143,7 +143,8 @@ module.exports = class Service {
143143 this . webpackRawConfigFns . forEach ( fn => {
144144 if ( typeof fn === 'function' ) {
145145 // function with optional return value
146- config = fn ( config ) || config
146+ const res = fn ( config )
147+ if ( res ) config = merge ( config , res )
147148 } else if ( fn ) {
148149 // merge literal values
149150 config = merge ( config , fn )
You can’t perform that action at this time.
0 commit comments