ionic-team / vscode-ionic

Visual Studio Code Ionic Extension
Other
6 stars 0 forks source link

How to make the Nexus Browser auto-discover the local Dev Server application when running `ionic serve --external` via npm scripts #145

Open KoltonG opened 9 months ago

KoltonG commented 9 months ago

Context

I've been really enjoying the Ionic VSCode extension and how the Nexus Browser on my phone just picks up the local Dev Server! As our project has gotten more and more complex, we've had to move away from using Run > Web (from the VSCode Extension) due to needing many environment variables and pre-build steps.

Question

The issue I am facing is that when I run ionic serve --external via npm scripts, the Nexus Browser doesn't see to auto-discover the local Dev Server like it does with Run > Web. I was wondering how does the Ionic VSCode extension does this, and if there is a way to enable this with the npm script way of running the application?

dtarnawsky commented 9 months ago

Hi @KoltonG ,

The extension broadcasts the list of external IP Addresses and port information via UDP which is picked up by Nexus Browser. For this to work via CLI only the Ionic CLI would need to be modified to perform the same functionality.

KoltonG commented 9 months ago

Thank you @dtarnawsky! Wondering if there is a bash script or code that you could share on how it does this (as I can't seem to find the source for the VSCode Extension)?

I'm thinking that I could write a small script that runs with the ionic serve process to potentially do this while waiting for this feature to potentially be included in the next iterations of the Ionic CLI (as I am not sure of how high priority this would be on your roadmap)?

dtarnawsky commented 8 months ago

Looking at whether this can be added to the Ionic or Capacitor CLI. Most likely added to the Capacitor CLI as part of changes for live reload.