How to Remove Cordova Plugin From Ionic

Sometimes when developing your app you may decide not to use a certain plugin anymore or you come across some errors that are caused because of a plugin. Depending on the error, it’s sometimes fixed by removing platforms and adding them again, but in this article we will focus on removing Cordova plugins from ionic.

So first thing’s first, let’s get a list of installed plugins

1
$ ionic cordova plugin list

This will list all the installed Cordova plugins within that project

let’s say we want to remove base64ToGallery plugin.
We can proceed with

1
$ ionic cordova plugin remove cordova-base64-to-gallery

you can find the name of the plugin in the cordova plugin list


Next since this is an ionic native plugin we need to remove it from package.json


Now go ahead and run

1
$ npm uninstall @ionic-native/base64-to-gallery

you can find the name of the package in the package.json file

After this make sure to remove the import from your file where you have imported that plugin and remove it from the constructor.

Now you are done. But just to be on the safe side after i remove a plugin i always run

1
$ ionic cordova platform remove android

and

1
$ ionic cordova platform remove ios

And than i add them again

1
$ ionic cordova platform add android

and

1
$ ionic cordova platform add ios

Now after the platforms are added again you are all set and can continue with development.

Thanks and cya in the next one.

Share