Search code examples
cordovaphonegap-plugins

How to add Live Reload when using the command cordova serve?


I am using this command to open up my app in the browser: cordova serve but it does not refresh itself when I update my code. How can I do that?

I have tried to use phonegap serve instead which has a live reload but it keeps sending me alerts and crashes my browser.

So, if you can please tell me how can I solve either of the two issues that will be wonderful.


Solution

  • You could try the Cordova Browsersync plugin. Instructions to use the plugin are in the plugin's repo.

    Once you add this plugin using cordova plugin add cordova-plugin-browsersync, you can simply use cordova run -- --live-reload to start live reload. Note that this also enables syncing scrolls and clicks if you have multiple devices.