What is the difference between ionic and cordova plugins?

Hi, I was wondering what is the difference between an ionic installation of plugin and cordova’s.

In ionic’s docs it stated as:
-ionic cordova plugin add cordova-plugin-camera
-npm install @ionic-native/camera

But in cordova it’s like:

  • cordova plugin add cordova-plugin-camera

-Why do i have to prepend the cordova command with ‘ionic’ keyword?
-Why do i have to download @ionic-native/camera from npm?

You don’t have to, but the Ionic-Native shim layer provides convenient integration with the framework, such as converting callbacks to Promises. I recommend using it. However, in that specific example of the camera, please consider taking a look at Capacitor instead.


Adding more to this

@ionic-native is just a helper library. It does NOT replace the plugin itself. Just provides some functionality to work with Angular.

As for the CLI or " prepend the cordova command with ‘ionic’ keyword?" part, this is because you’re invoking the Ionic CLI, not the cordova one.


Is it normal if i didn’t prepend ionic, or i should do it?

You should be doing this. We do some extra work in there to make sure plugins and your package.json/config.xml stay in sync.