Skip to content

Getting Started

Terminal window
npm install @capgo/capacitor-patch
npx cap sync

The package is a no-op until you select patches in your Capacitor config.

List all shipped patches:

Terminal window
npx capgo-capacitor-patch list --all

Then add the patch IDs your app needs to capacitor.config.ts:

import type { CapacitorConfig } from '@capacitor/cli';
const config: CapacitorConfig = {
appId: 'com.example.app',
appName: 'Example',
webDir: 'dist',
plugins: {
CapacitorPatch: {
patches: ['upstream-pr-8418-android'],
strict: true,
},
},
};
export default config;

Run sync again:

Terminal window
npx cap sync

Package patches run before sync and update. Native project patches run after sync and update.

Use doctor to check whether selected patches match your installed package versions:

Terminal window
npx capgo-capacitor-patch doctor --phase package --strict

Use apply when you want to run the selected patches manually:

Terminal window
npx capgo-capacitor-patch apply --phase package
OptionTypeDefaultDescription
recommendedbooleanfalseApplies patches Capgo marks as recommended.
patchesstring[][]Applies explicit patch IDs.
disabledstring[][]Skips selected patch IDs, even when recommended.
strictbooleanfalseThrows when a selected patch is incompatible or cannot apply.
Terminal window
npx capgo-capacitor-patch list --all
npx capgo-capacitor-patch doctor
npx capgo-capacitor-patch apply

Useful options:

  • --root <dir> sets the app root.
  • --phase package|native|all limits which patch phase runs.
  • --platform ios|android applies platform filtering outside a Capacitor hook.
  • --strict treats selected patch failures as errors.
  1. Install @capgo/capacitor-patch.
  2. Run npx capgo-capacitor-patch list --all.
  3. Add the selected patch IDs to plugins.CapacitorPatch.patches.
  4. Run npx capgo-capacitor-patch doctor --strict.
  5. Run npx cap sync.

When a selected patch targets @capacitor/cli, the patch applies to the installed CLI package and the next cap command uses the patched CLI code.