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

后端 未结 6 654
北恋
北恋 2021-02-01 22:17

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 trie

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-02-01 22:45

    The cordova-plugin-browsersync can be out-dated. Alternatively, you can use watch command like:

    1. npm install watch --save-dev

    2. Go to scripts line under the package.json file then add:

      "dev": "watch 'cordova run browser' www"

    3. npm run dev

    It will automatically refresh the page when you change anything under the www folder.

    Sample screenshot:

提交回复
热议问题