File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,8 @@ function colorError(useColor, msg) {
39
39
return msg ;
40
40
}
41
41
42
+ const defaultTo = ( value , def ) => value == null ? def : value ;
43
+
42
44
const yargs = require ( "yargs" )
43
45
. usage ( `${ versionInfo ( )
44
46
} \nUsage: https://webpack.js.org/configuration/dev-server/`) ;
@@ -317,8 +319,8 @@ function processOptions(wpOpt) {
317
319
// that wouldn't throw errors. E.g. both argv.port and options.port
318
320
// were specified, but since argv.port is 8080, options.port will be
319
321
// tried first instead.
320
- options . port = argv . port === DEFAULT_PORT ? ( options . port || argv . port ) : ( argv . port || options . port ) ;
321
- if ( options . port ) {
322
+ options . port = argv . port === DEFAULT_PORT ? defaultTo ( options . port , argv . port ) : defaultTo ( argv . port , options . port ) ;
323
+ if ( options . port != null ) {
322
324
startDevServer ( wpOpt , options ) ;
323
325
return ;
324
326
}
You can’t perform that action at this time.
0 commit comments