@@ -873,17 +873,12 @@ class WebpackCLI {
873873 ( optionForCommand as Option & { configs : ArgumentConfig [ ] } ) . configs = option . configs ;
874874 }
875875
876- command . addOption ( optionForCommand ) ;
877- } else if ( mainOption . type . size === 0 && negativeOption ) {
878- const optionForCommand = new Option ( mainOption . flags , mainOption . description ) ;
879-
880- // Hide stub option
881- optionForCommand . hidden = option . hidden || false ;
882- ( optionForCommand as Option & { internal ?: boolean } ) . internal = true ;
883-
884876 command . addOption ( optionForCommand ) ;
885877 }
886878
879+ // A situation arises when `mainOption.type.size === 0 && negativeOption`
880+ // In this case, we don't create the option, since this means the option only has a negative value
881+
887882 if ( negativeOption ) {
888883 const optionForCommand = new Option ( negativeOption . flags , negativeOption . description ) . default (
889884 false ,
@@ -1048,10 +1043,6 @@ class WebpackCLI {
10481043 } ,
10491044 visibleOptions : function visibleOptions ( command ) {
10501045 return command . options . filter ( ( option ) => {
1051- if ( ( option as Option & { internal ?: boolean } ) . internal ) {
1052- return false ;
1053- }
1054-
10551046 // Hide `--watch` option when developer use `webpack watch --help`
10561047 if (
10571048 ( options [ 0 ] === "w" || options [ 0 ] === "watch" ) &&
@@ -1986,10 +1977,7 @@ class WebpackCLI {
19861977 }
19871978
19881979 for ( const option of command . options ) {
1989- if (
1990- ! ( option as Option & { internal ?: boolean } ) . internal &&
1991- distance ( name , option . long ?. slice ( 2 ) as string ) < 3
1992- ) {
1980+ if ( distance ( name , option . long ?. slice ( 2 ) as string ) < 3 ) {
19931981 this . logger . error ( `Did you mean '--${ option . name ( ) } '?` ) ;
19941982 }
19951983 }
0 commit comments