Skip to content

Commit 14275c7

Browse files
committed
fix(serve): open browser to localhost
open browser to localhost
1 parent 39edd2e commit 14275c7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/serve.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,15 @@ export function serve(context?: BuildContext) {
5050
}
5151

5252
function onReady(config: ServeConfig, context: BuildContext) {
53+
const host = config.host === '0.0.0.0' ? 'localhost' : config.host;
5354
if (config.launchBrowser || config.launchLab) {
54-
const openOptions: string[] = [`http://${config.host}:${config.httpPort}`]
55+
const openOptions: string[] = [`http://${host}:${config.httpPort}`]
5556
.concat(launchLab(context) ? [IONIC_LAB_URL] : [])
5657
.concat(browserOption(context) ? [browserOption(context)] : [])
5758
.concat(platformOption(context) ? ['?ionicplatform=', platformOption(context)] : []);
5859

5960
open(openOptions.join(''), browserToLaunch(context));
6061
}
61-
const host = config.host === '0.0.0.0' ? 'localhost' : config.host;
6262
Logger.info(`dev server running: http://${host}:${config.httpPort}/`, 'green', true);
6363
Logger.newLine();
6464
}

0 commit comments

Comments
 (0)