@@ -598,17 +598,21 @@ class Server {
598
598
let networkUrlIPv4 ;
599
599
let networkUrlIPv6 ;
600
600
601
- if ( this . hostname && this . hostname !== 'localhost' ) {
602
- let isIP ;
601
+ if ( this . hostname ) {
602
+ if ( this . hostname === 'localhost' ) {
603
+ localhost = prettyPrintUrl ( 'localhost' ) ;
604
+ } else {
605
+ let isIP ;
603
606
604
- try {
605
- isIP = ipaddr . parse ( this . hostname ) ;
606
- } catch ( error ) {
607
- // Ignore
608
- }
607
+ try {
608
+ isIP = ipaddr . parse ( this . hostname ) ;
609
+ } catch ( error ) {
610
+ // Ignore
611
+ }
609
612
610
- if ( ! isIP ) {
611
- server = prettyPrintUrl ( this . hostname ) ;
613
+ if ( ! isIP ) {
614
+ server = prettyPrintUrl ( this . hostname ) ;
615
+ }
612
616
}
613
617
}
614
618
@@ -629,8 +633,6 @@ class Server {
629
633
networkUrlIPv6 = prettyPrintUrl ( networkIPv6 ) ;
630
634
}
631
635
} else if ( parsedIP . range ( ) === 'loopback' ) {
632
- localhost = prettyPrintUrl ( 'localhost' ) ;
633
-
634
636
if ( parsedIP . kind ( ) === 'ipv4' ) {
635
637
loopbackIPv4 = prettyPrintUrl ( parsedIP . toString ( ) ) ;
636
638
} else if ( parsedIP . kind ( ) === 'ipv6' ) {
@@ -653,8 +655,9 @@ class Server {
653
655
this . logger . info ( `Server: ${ colors . info ( useColor , server ) } ` ) ;
654
656
}
655
657
656
- if ( localhost ) {
657
- const loopbacks = [ colors . info ( useColor , localhost ) ]
658
+ if ( localhost || loopbackIPv4 || loopbackIPv6 ) {
659
+ const loopbacks = [ ]
660
+ . concat ( localhost ? [ colors . info ( useColor , localhost ) ] : [ ] )
658
661
. concat ( loopbackIPv4 ? [ colors . info ( useColor , loopbackIPv4 ) ] : [ ] )
659
662
. concat ( loopbackIPv6 ? [ colors . info ( useColor , loopbackIPv6 ) ] : [ ] ) ;
660
663
0 commit comments