Search code examples
cordovaphonegap-pluginscordova-plugins

cordova/phonegap plugin add VS config.xml


There's something I find quite confusing about phonegap/cordova plugins.

For example I can run

cordova plugin add cordova-plugin-whitelist

OR

phonegap plugin add cordova-plugin-whitelist

Doing so does not modify the config.xml file


Or I can add to config.xml:

<plugin name="cordova-plugin-whitelist" spec="1.1.0" />

OR

<gap:plugin name="cordova-plugin-whitelist" spec="1.1.0" />


What are exactly the differences between all these different plugin installations? Which one should I use in the end?

I want the same plugins to be available on all the other developers computers, in the exact same version to have a stable and reproductible environment (and the CLI does not seem to specify the version...). Should I include anything of my /plugins folder to Git?

Note: if it matters, I don't know yet which of cordova or phonegap CLI I'll use in the future, as I don't know yet if I'll use Phonegap Build. For the moment both CLI (v5.1.1) seems to work fine.


Solution

  • Use:

    cordova plugin add cordova-plugin-whitelist --save

    Source