@@ -60,6 +60,7 @@ export interface DevServerBuilderOptions {
60
60
verbose ?: boolean ;
61
61
}
62
62
63
+ type DevServerBuilderOptionsKeys = Extract < keyof DevServerBuilderOptions , string > ;
63
64
64
65
export class DevServerBuilder implements Builder < DevServerBuilderOptions > {
65
66
@@ -392,24 +393,30 @@ export class DevServerBuilder implements Builder<DevServerBuilderOptions> {
392
393
const architect = this . context . architect ;
393
394
const [ project , target , configuration ] = options . browserTarget . split ( ':' ) ;
394
395
395
- const overrides = {
396
- // Override browser build watch setting.
397
- watch : options . watch ,
398
-
399
- // Update the browser options with the same options we support in serve, if defined.
400
- ...( options . optimization !== undefined ? { optimization : options . optimization } : { } ) ,
401
- ...( options . aot !== undefined ? { aot : options . aot } : { } ) ,
402
- ...( options . sourceMap !== undefined ? { sourceMap : options . sourceMap } : { } ) ,
403
- ...( options . vendorSourceMap !== undefined ?
404
- { vendorSourceMap : options . vendorSourceMap } : { } ) ,
405
- ...( options . evalSourceMap !== undefined ? { evalSourceMap : options . evalSourceMap } : { } ) ,
406
- ...( options . vendorChunk !== undefined ? { vendorChunk : options . vendorChunk } : { } ) ,
407
- ...( options . commonChunk !== undefined ? { commonChunk : options . commonChunk } : { } ) ,
408
- ...( options . baseHref !== undefined ? { baseHref : options . baseHref } : { } ) ,
409
- ...( options . progress !== undefined ? { progress : options . progress } : { } ) ,
410
- ...( options . poll !== undefined ? { poll : options . poll } : { } ) ,
411
- ...( options . verbose !== undefined ? { verbose : options . verbose } : { } ) ,
412
- } ;
396
+ const overridesOptions : DevServerBuilderOptionsKeys [ ] = [
397
+ 'watch' ,
398
+ 'optimization' ,
399
+ 'aot' ,
400
+ 'sourceMap' ,
401
+ 'vendorSourceMap' ,
402
+ 'evalSourceMap' ,
403
+ 'vendorChunk' ,
404
+ 'commonChunk' ,
405
+ 'baseHref' ,
406
+ 'progress' ,
407
+ 'poll' ,
408
+ 'verbose' ,
409
+ ] ;
410
+
411
+ // remove options that are undefined or not to be overrriden
412
+ const overrides = ( Object . keys ( options ) as DevServerBuilderOptionsKeys [ ] )
413
+ . filter ( key => options [ key ] !== undefined && overridesOptions . includes ( key ) )
414
+ . reduce < Partial < BrowserBuilderSchema > > ( ( previous , key ) => (
415
+ {
416
+ ...previous ,
417
+ [ key ] : options [ key ] ,
418
+ }
419
+ ) , { } ) ;
413
420
414
421
const browserTargetSpec = { project, target, configuration, overrides } ;
415
422
const builderConfig = architect . getBuilderConfiguration < BrowserBuilderSchema > (
0 commit comments