EasyCord LogoDocs
Guides

Migrating from Capacitor to EasyCord

Migrate an existing Capacitor application to EasyCord.

Introduction

EasyCord replaces Capacitor by injecting native APIs globally into window.easycord. You do not install NPM packages for hardware access, removing dependency conflicts and reducing web bundle size.

Prerequisites

  • An existing Capacitor project.
  • Basic knowledge of Capacitor plugins.

Step 1: Run the Migration CLI

The easiest way to migrate is using the automated CLI tool, which scans your codebase and replaces Capacitor imports with EasyCord React/Vue wrappers.

npx @easycord/migrate

Step 2: Remove Capacitor Dependencies

Uninstall the Capacitor core and plugin packages from your project to reduce bundle size.

npm uninstall @capacitor/core @capacitor/camera @capacitor/dialog @capacitor/haptics @capacitor/preferences

Step 3: Update API Calls (Manual)

If you aren't using the CLI or need to handle edge cases, replace Capacitor API calls with their EasyCord equivalents manually.

import { Geolocation } from '@capacitor/geolocation';

async function getCapacitorPosition() {
  return await Geolocation.getCurrentPosition();
}

async function getEasyCordPosition() {
  return await window.easycord.gps.getCurrentPosition();
}

Step 3: Configure Permissions

Remove Capacitor permission logic from your JavaScript. Define all required permissions strictly in the easycord_permissions.yaml file. The Flutter shell handles OS-level prompts automatically.

permissions:
  - "gps.getCurrentPosition"
  - "camera.takePhoto"
  - "ui.overlays_showActionSheet"
  - "haptics.light"
  - "secureStorage.setItem"

Step 4: Build and Bundle

Generate your web assets and bundle them into the EasyCord shell instead of syncing with Xcode or Android Studio.

npm run build
easycord bundle

Verification

Run the EasyCord bundle command. The output confirms that the dist/ folder successfully copied into the native shell.

Troubleshooting

Undefined Method Error

Occurs when calling an EasyCord method that is not allowed. Ensure the method name exists in the allowed_methods list within easycord_permissions.yaml.

Next Steps