@@ -25,10 +25,13 @@ export function serve(context: BuildContext) {
2525
2626 return findClosestOpenPort ( host , notificationPort )
2727 . then ( ( notificationPortFound ) => {
28+ const hostPort = getHttpServerPort ( context ) ;
29+ const hostLocation = ( host === '0.0.0.0' ) ? 'localhost' : host ;
2830
2931 config = {
30- httpPort : getHttpServerPort ( context ) ,
32+ httpPort : hostPort ,
3133 host : host ,
34+ hostBaseUrl : `http://${ hostLocation } :${ hostPort } ` ,
3235 rootDir : context . rootDir ,
3336 wwwDir : context . wwwDir ,
3437 buildDir : context . buildDir ,
@@ -66,16 +69,15 @@ export function serve(context: BuildContext) {
6669}
6770
6871function onReady ( config : ServeConfig , context : BuildContext ) {
69- const host = config . host === '0.0.0.0' ? 'localhost' : config . host ;
7072 if ( config . launchBrowser || config . launchLab ) {
71- const openOptions : string [ ] = [ `http:// ${ host } : ${ config . httpPort } ` ]
73+ const openOptions : string [ ] = [ config . hostBaseUrl ]
7274 . concat ( launchLab ( context ) ? [ IONIC_LAB_URL ] : [ ] )
7375 . concat ( browserOption ( context ) ? [ browserOption ( context ) ] : [ ] )
7476 . concat ( platformOption ( context ) ? [ '?ionicplatform=' , platformOption ( context ) ] : [ ] ) ;
7577
7678 open ( openOptions . join ( '' ) , browserToLaunch ( context ) ) ;
7779 }
78- Logger . info ( `dev server running: http:// ${ host } : ${ config . httpPort } /` , 'green' , true ) ;
80+ Logger . info ( `dev server running: ${ config . hostBaseUrl } /` , 'green' , true ) ;
7981 Logger . newLine ( ) ;
8082}
8183
0 commit comments