I downloaded and installed latest version of the Visual Studio Ionic 2 templates for Visual Studio Tools for Apache Cordova. I am using Visual Studio 2017 Professional.
To my frustration, I've found that the live reload feature of the Cordova does not work at all. When I modify HTML, the only way for Cordova Simulate to reflect these changes is stop debugging and redeploy the project, which takes a considerable amount of time and makes the development workflow a real pain.
Another issue occurs whenever there is more than one Ionic project in progress. I found that because Ionic is using the same port for deployment then when one of the projects is launched, the launched app will get confused as to which app I'm requesting, and will often show the other app instead of the one I want.
Any ideas?
Sign in to your account While running ionic serve or ionic run <platform> -l no file changes trigger a reload or have any effect. (live reload not working).
One option that can boost productivity when building Ionic apps is Live Reload (or live-reload ). When active, Live Reload will reload the browser or Web View when changes in the app are detected. This is particularly useful for developing using hardware devices. Live Reload is a conflated term.
Capacitor does not yet have a programmatic build for development (track this issue for progress), so the Ionic CLI does not automatically forward ports for iOS and Android. To use Live Reload with Capacitor, make sure you're either using a virtual device or a hardware device connected to the same Wi-Fi network as your computer.
For Android devices, the Ionic CLI will automatically forward the dev server port. This means you can use a localhost address and it will refer to your computer when loaded in the Web View, not the device. The following all-in-one command will start a live-reload server on localhost and deploy the app to an Android device using Cordova:
You need to manually configure the "watch" task to be started when the project is opened. Add the following field:
"ProjectOpened": [ "watch" ]
to the "-vs-binding" object in your package.json.
I believe, it was supposed to be there by default (upon project creation), but it isn't. Also, you could try to configure it via Task Runner Explorer, but it didn't work either (at least, for me).
Also don't forget to re-open your solution after that change.
Please see @scale_tones's answer for part of the answer.
I looked into this further and found that there was an extra step that needed to be made here to resolve the issue. It turns out that a fix was implemented for this issue, but it doesn't appear to have been released anywhere as far as I can see.
However, it is possible to apply the fix manually. To do that, follow these steps:
1) Copy the contents of the watcher.js file from Github here
2) Use your file explorer to search for the watcher.js file on your machine. On my machine, the file was located at the following location:
C:\ProgramData\Microsoft\VisualStudio\MDA\a43fc8f0\taco-toolset-6.3.1\node_modules\cordova-simulate\src\server\live-reload
Replace the watcher.js file with the one from Github. This fixed the issue for me, and live reload now works for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With