@@ -1637,7 +1637,7 @@ class WebpackCLI implements IWebpackCLI {
16371637
16381638 const flag = this . getBuiltInOptions ( ) . find ( ( flag ) => option . long === `--${ flag . name } ` ) ;
16391639
1640- if ( flag && flag . configs ) {
1640+ if ( flag ? .configs ) {
16411641 const possibleValues = flag . configs . reduce (
16421642 ( accumulator , currentValue ) => {
16431643 if ( currentValue . values ) {
@@ -2243,9 +2243,8 @@ class WebpackCLI implements IWebpackCLI {
22432243
22442244 if (
22452245 options . isWatchingLikeCommand &&
2246- options . argv &&
2247- options . argv . env &&
2248- ( typeof originalWatchValue !== "undefined" || typeof options . argv . watch !== "undefined" )
2246+ options . argv ?. env &&
2247+ ( typeof originalWatchValue !== "undefined" || typeof options . argv ?. watch !== "undefined" )
22492248 ) {
22502249 this . logger . warn (
22512250 `No need to use the '${
@@ -2292,8 +2291,7 @@ class WebpackCLI implements IWebpackCLI {
22922291 // Respect `process.env.NODE_ENV`
22932292 if (
22942293 ! item . mode &&
2295- process . env &&
2296- process . env . NODE_ENV &&
2294+ process . env ?. NODE_ENV &&
22972295 ( process . env . NODE_ENV === "development" ||
22982296 process . env . NODE_ENV === "production" ||
22992297 process . env . NODE_ENV === "none" )
@@ -2408,14 +2406,11 @@ class WebpackCLI implements IWebpackCLI {
24082406 needWatchStdin ( compiler : Compiler | MultiCompiler ) : boolean {
24092407 if ( this . isMultipleCompiler ( compiler ) ) {
24102408 return Boolean (
2411- compiler . compilers . some (
2412- ( compiler : Compiler ) =>
2413- compiler . options . watchOptions && compiler . options . watchOptions . stdin ,
2414- ) ,
2409+ compiler . compilers . some ( ( compiler : Compiler ) => compiler . options . watchOptions ?. stdin ) ,
24152410 ) ;
24162411 }
24172412
2418- return Boolean ( compiler . options . watchOptions && compiler . options . watchOptions . stdin ) ;
2413+ return Boolean ( compiler . options . watchOptions ? .stdin ) ;
24192414 }
24202415
24212416 async runWebpack ( options : WebpackRunOptions , isWatchCommand : boolean ) : Promise < void > {
0 commit comments