pwa-builder / PWABuilder-CLI

Node.js tool for App Generation
Other
1.63k stars 142 forks source link

Developing hosted webapp and testing on local machine #286

Closed cdcv closed 6 years ago

cdcv commented 6 years ago

It would be great if you could add to the instructions what the procedure is for creating a hosted webapp that's hosted on localhost of a build build machine (ie on the machine that the webapp is being developed on, for example a mac, linux or windows box) and served to a physical device connected to that machine (eg by usb) so that changes can quickly be made on localhost and immediately served to the physical device for rapid testing.

I tried several approaches to accomplish this and haven't been very successful.

For example:

manifoldjs 01.01.01.01:3000 (replace with ip address of the local machine) produces manifoldjs build errors that I couldn't resolve.

manifoldjs localhost:3000 produces a build that works on the simulator, but not on physical devices (since localhost isn't on the same device).

changing the http proxy settings on the physical device to point to the ip address of the build machine and then manually changing the manifold within the app to use the ip address works, but it cumbersome (and if this is the best approach, would be great if it were documented).

If there's a good way to do this that doesn't require a wifi network shared by the local device and the build machine (eg using the local device as hotspot?) this might be applicable to more people/situations.

Thanks

boyofgreen commented 6 years ago

Hey @cdcv. I've started a doc for win10 testing: http://docs.pwabuilder.com/quickstart/2018/02/03/quick-start-sideload-pwa-win10.html

but I think what you want to do requires the CLI tool. In the CLI, you can use the "-m" command to point to the path of your local manifest, which can then point to local host. The CLI will then add the appropriate loopback exemption to allow the app to load from local host. This should allow development from offline. Let me know if you run into issues. Thanks, Jeff