How to force cordova to recompile added plugins?

不问归期 提交于 2019-12-04 23:10:25

Not afaik, the only workaround I've found is to use a before_prepare script to remove and add the plugin every time you prepare the app:

/
|--hooks/
   |--before_prepare/
      |--000_RefreshPluginXXX.sh

000_RefreshPluginXXX.sh:

!#/user/bin/env bash
cordova plugin rm yourPlugin
cordova plugin add yourPlugin

See here for details. Hope that sh file works under windows environment, otherwise you can do it with a .bat file.

Beaware that this is going to remove, download and reinstall the specified plugins for every platform every time that you prepare your app (prepare occurs when you build/emulate/compile)

Afaik there's no way to recompile the original files.

The quickest and most dirty way (still the best for quick checks) is to change the files under

e.g. (Android)

platforms/android/src/YOUR_PACKAGE/FILE_TO_CHANGE

that way it's automatically recompiled.

Obviously this file can be easily deleted or overwritten so it's just a way to quickly test SMALL changes.

From cordova>=6.0 you can install and link your local plugin path to the project instead of copy it so it will recompile each time you build.

cordova plugin add /local/path/to-plugin/ --link    

https://cordova.apache.org/docs/en/6.x/reference/cordova-cli/index.html#cordova-plugin-command

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!