From 25b6f05287fff80b0d18b86980741175f5e7a4d1 Mon Sep 17 00:00:00 2001 From: Ghustavh Ehm Date: Wed, 24 Feb 2021 03:50:51 +0200 Subject: [PATCH] fix(#3965): give --lab access to serve externalAddress This should fix a bug where lab is trying to always grab content from localhost even if the content is hosted on a different address. This should help with accessing lab on an external network in a browser when say for extample the ionic-cli is running on ubuntu server, where a browser is not available. The reason we will use `serveDetails.externalAddress` instead of `labDetails.host` is because `serve` is where we will be getting our content from and by default is hosted on a seperate port from lab. This change should not break anything since `serveDetails.externalAddress` will default to the initial `localhost` if no --host argument is passed. --- packages/@ionic/cli/src/lib/serve.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 packages/@ionic/cli/src/lib/serve.ts diff --git a/packages/@ionic/cli/src/lib/serve.ts b/packages/@ionic/cli/src/lib/serve.ts old mode 100644 new mode 100755 index 0027a043cc..0b7a8ef06b --- a/packages/@ionic/cli/src/lib/serve.ts +++ b/packages/@ionic/cli/src/lib/serve.ts @@ -672,7 +672,7 @@ class IonicLabServeCLI extends ServeCLI { const pkg = await this.e.project.requirePackageJson(); - const url = `${serveDetails.protocol}://localhost:${serveDetails.port}`; + const url = `${serveDetails.protocol}://${serveDetails.externalAddress}:${serveDetails.port}`; const appName = this.e.project.config.get('name'); const labArgs = [url, '--host', labDetails.host, '--port', String(labDetails.port), '--project-type', labDetails.projectType]; const nameArgs = appName ? ['--app-name', appName] : [];