@@ -6,7 +6,6 @@ export class Options {
66 private static NONDASHED_OPTION_REGEX = / ( .+ ?) [ - ] ( [ a - z A - Z ] ) ( .* ) / ;
77
88 private optionsWhiteList = [ "ui" , "recursive" , "reporter" , "require" , "timeout" , "_" , "$0" ] ; // These options shouldn't be validated
9- private yargsArgv : yargs . Argv ;
109 private globalOptions : IDictionary < IDashedOption > = {
1110 log : { type : OptionType . String , hasSensitiveValue : false } ,
1211 verbose : { type : OptionType . Boolean , alias : "v" , hasSensitiveValue : false } ,
@@ -19,6 +18,7 @@ export class Options {
1918 _ : { type : OptionType . String , hasSensitiveValue : false }
2019 } ;
2120
21+ private initialArgv : yargs . Arguments ;
2222 public argv : yargs . Arguments ;
2323 public options : IDictionary < IDashedOption > ;
2424
@@ -31,7 +31,7 @@ export class Options {
3131 this . argv . bundle = "webpack" ;
3232
3333 // Check if the user has explicitly provide --hmr and --release options from command line
34- if ( this . yargsArgv . argv . release && this . yargsArgv . argv . hmr ) {
34+ if ( this . initialArgv . release && this . initialArgv . hmr ) {
3535 this . $errors . failWithoutHelp ( "The options --release and --hmr cannot be used simultaneously." ) ;
3636 }
3737
@@ -250,8 +250,9 @@ export class Options {
250250 opts [ this . getDashedOptionName ( key ) ] = value ;
251251 } ) ;
252252
253- this . yargsArgv = yargs ( process . argv . slice ( 2 ) ) ;
254- this . argv = this . yargsArgv . options ( < any > opts ) . argv ;
253+ const parsed = yargs ( process . argv . slice ( 2 ) ) ;
254+ this . initialArgv = parsed . argv ;
255+ this . argv = parsed . options ( < any > opts ) . argv ;
255256
256257 // For backwards compatibility
257258 // Previously profileDir had a default option and calling `this.$options.profileDir` always returned valid result.
0 commit comments