Ive noticed that Ionic now updates package.json
(in some cases removing lines from it). Im told its because some plugins are no longer needed so Ionic removes them. Can someone point me to some documentation on this or explain what is and isn’t included with Ionic now? Is there a definitive list? When was this change made?
@eno the ionic CLI comes with some hooks for adding/removing plugin ids to your package.json when you add/remove a plugin. So for example, if you decide you need inappbroswer, and run “cordova plugin add idorurlforinappbrowser” the hook will run AFTER the plugin is added, then add that id to your package.json cordovaPlugins array. And if you remove a plugin from your project, the plugin will be removed from your package.json cordovaPlugins array as well.
The benefit for this is, say I was to checkout your project form github, instead of me having to ask you which plugins are required for your project (since its not best practice to commit plugins to VCS), then all I have to do is add a cordova platform, and a hook will check the package.json cordovaPlugins array and add each plugin to my projects plugin folder.
So its a nice feature ionic added so that you only have to manually add/remove a cordova plugin once and then plugins are automatically managed through the package.json and ionic hooks.
We already have a script under hooks
that adds our plugins whenever we add a platform. Sounds like Ionic duplicates what we already do using Cordova’s hooks?
yeah when you build with the ionic CLI it will add their hooks to your cordova hooks folder so you might have to mesh the 2 together if you have some custom logic, either that or remove yours and let ionic do it’s thing.
We’ve removed ours (and other scripts since Ionic seems to take care of the activity name too now
However, Ive noticed Ionic will sometimes fail to install a plugin that’s listed in the CordovaPlugins
array in package.json
and updates package.json
remove those lines that had the failed plugins. Can someone explain under what circumstances this will happen?
What’s also strange is if I remove both platforms, then (re)add ios, then (re)add android again afterwards it will magically install all of the plugins properly…