File tree 2 files changed +43
-1
lines changed
2 files changed +43
-1
lines changed Original file line number Diff line number Diff line change @@ -200,8 +200,12 @@ class Server {
200
200
return level ;
201
201
} ;
202
202
203
+ const configs = getCompilerConfigArray ( this . compiler ) ;
204
+ const configWithDevServer =
205
+ configs . find ( ( config ) => config . devServer ) || configs [ 0 ] ;
206
+
203
207
proxyOptions . logLevel = getLogLevelForProxy (
204
- this . compiler . options . infrastructureLogging . level
208
+ configWithDevServer . infrastructureLogging . level
205
209
) ;
206
210
proxyOptions . logProvider = ( ) => this . logger ;
207
211
Original file line number Diff line number Diff line change @@ -474,4 +474,42 @@ describe('proxy option', () => {
474
474
req . delete ( '/delete' ) . expect ( 200 , 'DELETE method from proxy' , done ) ;
475
475
} ) ;
476
476
} ) ;
477
+
478
+ describe ( 'should work in multi compiler mode' , ( ) => {
479
+ let server ;
480
+ let req ;
481
+ let closeProxyServers ;
482
+
483
+ beforeAll ( ( done ) => {
484
+ closeProxyServers = startProxyServers ( ) ;
485
+ server = testServer . start (
486
+ [ config , config ] ,
487
+ {
488
+ static : {
489
+ directory : contentBase ,
490
+ watch : false ,
491
+ } ,
492
+ proxy : {
493
+ '*' : {
494
+ context : ( ) => true ,
495
+ target : `http://localhost:${ port1 } ` ,
496
+ } ,
497
+ } ,
498
+ port : port3 ,
499
+ } ,
500
+ done
501
+ ) ;
502
+ req = request ( server . app ) ;
503
+ } ) ;
504
+
505
+ afterAll ( ( done ) => {
506
+ testServer . close ( ( ) => {
507
+ closeProxyServers ( done ) ;
508
+ } ) ;
509
+ } ) ;
510
+
511
+ it ( 'respects a proxy option' , ( done ) => {
512
+ req . get ( '/proxy1' ) . expect ( 200 , 'from proxy1' , done ) ;
513
+ } ) ;
514
+ } ) ;
477
515
} ) ;
You can’t perform that action at this time.
0 commit comments