Skip to main content
@capgo/capacitor-live-reload Updates Open source

Live Reload Capacitor plugin

Connect to your dev server for instant hot reloading during development

Install

bun add @capgo/capacitor-live-reload bunx cap sync
npm, pnpm or yarn
  • npm install @capgo/capacitor-live-reload
  • pnpm add @capgo/capacitor-live-reload
  • yarn add @capgo/capacitor-live-reload

Guide

How to use Live Reload in Capacitor

Using @capgo/capacitor-live-reload

Capacitor plugin to live reload Capacitor apps from a remote Vite dev server.

Install

bun add @capgo/capacitor-live-reload
bunx cap sync

bunx cap sync copies the plugin's native code into your native projects. Run it again after every plugin upgrade.

Import

import { LiveReload } from '@capgo/capacitor-live-reload';

API at a glance

Method Description
configureServer Store remote dev server settings used for subsequent connections.
connect Establish a WebSocket connection if one is not already active.
disconnect Close the current WebSocket connection and disable auto reconnect.
getStatus Returns the current connection status.
reload Trigger a full reload of the Capacitor WebView.
reloadFile Reload a single file/module if the runtime supports it (falls back to full reload).

Examples

configureServer()

Store remote dev server settings used for subsequent connections.

import { LiveReload } from '@capgo/capacitor-live-reload';

const result = await LiveReload.configureServer({ url: 'https://example.com' });
console.log(result);

connect()

Establish a WebSocket connection if one is not already active.

import { LiveReload } from '@capgo/capacitor-live-reload';

const result = await LiveReload.connect();
console.log(result);

disconnect()

Close the current WebSocket connection and disable auto reconnect.

import { LiveReload } from '@capgo/capacitor-live-reload';

const result = await LiveReload.disconnect();
console.log(result);

getStatus()

Returns the current connection status.

import { LiveReload } from '@capgo/capacitor-live-reload';

const result = await LiveReload.getStatus();
console.log(result);

reload()

Trigger a full reload of the Capacitor WebView.

import { LiveReload } from '@capgo/capacitor-live-reload';

await LiveReload.reload();

reloadFile()

Reload a single file/module if the runtime supports it (falls back to full reload).

import { LiveReload } from '@capgo/capacitor-live-reload';

await LiveReload.reloadFile({ path: 'path/to/file' });

Listen to events

addListener returns a handle. Call handle.remove() when the screen unmounts, or LiveReload.removeAllListeners() to clear every listener.

Full reference

Keep going from Using @capgo/capacitor-live-reload

If you are using Using @capgo/capacitor-live-reload to plan native plugin work, connect it with @capgo/capacitor-live-reload for the implementation detail in @capgo/capacitor-live-reload, Getting Started for the implementation detail in Getting Started, Capgo Plugin Directory for the product workflow in Capgo Plugin Directory, Capacitor Plugins by Capgo for the implementation detail in Capacitor Plugins by Capgo, and Adding or Updating Plugins for the implementation detail in Adding or Updating Plugins.

FAQ

Live Reload plugin FAQ

How do I install the Live Reload plugin in a Capacitor app?

Run "bun add @capgo/capacitor-live-reload" (or "npm install @capgo/capacitor-live-reload"), then run "bunx cap sync" so the iOS and Android projects pick up the native code. Import it from "@capgo/capacitor-live-reload" in your app code.

Does @capgo/capacitor-live-reload work with React, Vue and Angular?

Yes. Live Reload is a Capacitor package, so it works with any web framework that runs inside Capacitor, including Ionic, React, Vue, Angular, Svelte and plain JavaScript.

Which Capacitor version does @capgo/capacitor-live-reload support?

Capgo plugins follow Capacitor's major version: use the plugin major version that matches your Capacitor major version (for example plugin v8 with Capacitor 8). The compatibility table in the GitHub README lists the maintained versions.

Is @capgo/capacitor-live-reload free and open source?

Yes. The source code is public on GitHub at https://github.com/Cap-go/capacitor-live-reload/ and the package is free to install from npm. Bug reports and pull requests are welcome.

Can I update code that uses Live Reload without an App Store review?

Installing or upgrading the plugin changes native code, so it needs a new store build. After that, JavaScript, HTML and CSS changes that call the plugin can ship instantly with Capgo live updates.

Ship Live Reload changes without waiting for app review

Once the plugin is in your store build, Capgo live updates push your JavaScript, HTML and CSS changes to users in minutes.

Start with Capgo