These docs cover qiankun 3.0 (RC) — install it with npm i qiankun@rc. For 2.x, see the v2 docs.
Skip to content

isRuntimeCompatible

Check whether the current browser provides the minimum capabilities required by the qiankun v3 runtime. Use it before loading an app when the host needs to show a fallback for unsupported browsers.

Signature

ts
function isRuntimeCompatible(): boolean;

The check is synchronous, takes no arguments, and does not modify runtime state.

What it checks

isRuntimeCompatible() returns true only when these three APIs are available:

CapabilityWhy qiankun needs it
ProxyJavaScript isolation
TransformStreamStreaming HTML-entry loading
URL.createObjectURLIsolated script execution

Use the probe instead of maintaining a browser-version list in application code.

Usage

ts
import { isRuntimeCompatible, loadMicroApp } from 'qiankun';

const container = document.getElementById('micro-app-slot');
if (!container) throw new Error('micro-app-slot not found');

if (!isRuntimeCompatible()) {
  container.textContent = 'Please use a supported browser.';
} else {
  const microApp = loadMicroApp({
    name: 'account-app',
    entry: 'https://account.example.com',
    container,
  });

  void microApp.mountPromise.catch((error: unknown) => {
    console.error('Failed to mount account-app', error);
  });

  // Keep microApp and call microApp.unmount() when this view is removed.
}

Route-driven hosts can run the same check before registerMicroApps and start.

What it does not check

The result only covers the three core runtime APIs above. It does not verify:

In particular, the native ESM path requires multiple dynamically injected import maps. Firefox does not enable that behavior by default, even when isRuntimeCompatible() returns true; ship classic scripts instead (for example, Webpack builds) when Firefox support is required.

Released under the MIT License.