Removing a plugin

How to remove a plugin in Ionic Capacitor app

Installing plugin in Capacitor is a little different from Cordova. Since Cordova considers the platform code as build time asset, it compiles the platform every time a build is made.

Capacitor works differently. It compiles the platforms once, and further changes can be simply copied into the platforms using npx cap sync

Plugins are installed as npm or yarn package in Capacitor. Hence, to remove them,

  • You will have to remove the package from package.json and also remove it from node_modules using npm uninstall <packageName>

  • In case the package has already been copied to platforms, you will have to "undo" all the steps you did when attaching those packages / plugins to the platforms. E.g. When implementing Facebook Login in Capacitor, as detailed in our tutorial here, You need to make few modifications in Android project using Android Studio

There are changes done in android/app/src/main/java/**/**/MainActivity.java, android/app/src/main/AndroidManifest.xml and android/app/src/main/res/values/strings.xml . All these changes need to be undone to remove all traces of the package from the project.

Check the details in our detailed tutorial here for Facebook Login Plugin. A similar process will be needed for other plugins as well.

Last updated