Skip to content

feat(cli): add support for disabling plugins in configuration - #8615

Open
jtsnova wants to merge 4 commits into
ionic-team:mainfrom
jtsnova:feat/support-disabling-plugins
Open

jtsnova wants to merge 4 commits into
ionic-team:mainfrom
jtsnova:feat/support-disabling-plugins

Conversation

@jtsnova

@jtsnova jtsnova commented Sep 21, 2026 •

Copy link
Copy Markdown

Description

Adds a plugins.<PluginName>.disabled config option to prevent a native Capacitor plugin from being registered and loaded:

const config: CapacitorConfig = {
  plugins: {
    MyPlugin: {
      disabled: true,
    },
  },
};

The setting is read from the native capacitor.config.json generated by npx cap sync.

  • Android: Bridge.registerPlugin() and Bridge.registerPluginInstance() check the plugin configuration before creating a PluginHandle.
  • iOS: CapacitorBridge.loadPlugin(type:) checks the configuration before loading, registering, and exporting the plugin to JavaScript.

Change Type

  • Fix
  • Feature
  • Refactor
  • Breaking Change
  • Documentation

Rationale / Problems Fixed

There is currently no runtime configuration mechanism to prevent an installed native plugin from loading. This makes it difficult to selectively disable a plugin while retaining it as a project dependency or while sharing configuration across builds.

disabled is intentionally separate from enabled, because plugins such as CapacitorHttp and CapacitorCookies already use enabled with plugin-specific behavior.

Nothing changes unless plugins.<PluginName>.disabled is set to true. Plugins remain enabled by default.

Tests or Reproductions

  • npm run build --workspace @capacitor/cli completes successfully.
  • Changed TypeScript and Java files pass Prettier formatting checks.
  • Added Android configuration coverage for reading plugins.<PluginName>.disabled.
  • The Android unit-test suite could not be run in the current environment because the project requires Java 21 and the available JDK is older.

Platforms Affected

  • Android
  • iOS
  • Web

Notes / Comments

A disabled plugin is not registered, instantiated, loaded, or exported through the native bridge. Therefore, it is not exposed through native plugin headers and Capacitor.isPluginAvailable('MyPlugin') returns false.

@jtsnova jtsnova changed the title feat: add support for disabling plugins in configuration feat(cli): add support for disabling plugins in configuration Sep 21, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant