Search code examples
ionic-frameworkcapacitor

Installing plugin the Capacitor way still requires the Cordova plugin


When I install for example the Insomnia plugin the Capacitor way like so:

npm install cordova-plugin-insomnia
npm install @ionic-native/insomnia
ionic cap sync

It still requires me to install the cordova plugin like this:

ionic cordova plugin add cordova-plugin-insomnia

In order to work. Otherwise it says: plugin_not_installed

My steps to make it work are:

Step 1: Add Insomnia to providers (@ionic-native/insomnia/ngx)

Step 2: Inject Insomnia within the constructor private insomnia: Insomnia

Am I forgetting something or do I just really need to ionic cordova plugin add for plugins that are not fully supported yet?


Solution

  • Probably obvious for most but just in case someone else might face this problem..

    When you use capacitor you shouldn't start your server with ionic cordova run or ionic cordova build anymore.

    Obviously you need to start it this way for livereload:

    ionic cap run android -l --external
    ionic cap run ios -l --external