Gerald
Gerald

Reputation: 814

How to exclude certain ionic native plugins from a specific platform?

We are using the NFC Scanner plugin in our ionic 5 project on the Android platform: https://ionicframework.com/docs/native/nfc

How can we exclude this plugin from our iOS platform? Is there a built-in way in Capacitor to exclude certain plugins from a specific platform? We want to avoid uninstalling the plugin each time when we run 'ionic cap sync ios'.

Upvotes: 1

Views: 1251

Answers (1)

RGe
RGe

Reputation: 1815

It's not possible to "exclude" one plugin, but you can specify the plugins to include, so you should add all the plugins except the ones you want to exclude in includePlugins object. https://capacitorjs.com/docs/config

Source: https://github.com/ionic-team/capacitor/issues/5084#issuecomment-931288615

capacitor.config.ts:

import { CapacitorConfig } from '@capacitor/cli';

const config: CapacitorConfig = {
  appId: 'com.company.appname',
  appName: 'My Capacitor App',
  webDir: 'www',
  ios: {
    includePlugins: ['cordova-plugin-calendar', '...']
  }
};

export default config;

Upvotes: 3

Related Questions