qiankun 3.0: A Micro-Frontend Runtime for Modern Browsers
Three years since our last major release

Since open-sourcing 1.0 in 2019 and evolving into a micro-app loader in 2.0 in 2020, qiankun has powered a large number of enterprise web applications. Yet 2.x was designed for the Webpack UMD and IE-compatibility era. As Vite, native ESM, and newer web standards became the norm, stacking more features on top of 2.x's foundation was no longer sustainable.
Instead of patching 2.x further, we rewrote the runtime from the ground up for modern browsers in qiankun 3.0.
What's New in 3.0?
New features:
- Client-side streaming rendering with the
@qiankunjs/loaderstreaming HTML Entry loader - Native ESM sandbox with direct support for
<script type="module">and Vite apps - Style isolation built on native CSS
@scope - Standalone JS sandbox in
@qiankunjs/sandbox - Official
<MicroApp />components for React (@qiankunjs/react) and Vue (@qiankunjs/vue) - Unified bundler plugin
@qiankunjs/bundler-pluginfor Webpack 4/5 and Vite - Official Agent Skill (
npx skills add umijs/qiankun) so coding agents can scaffold v3 integrations directly
Architecture & API changes:
- Reorganized into a pnpm monorepo with
loader,sandbox,shared, and other modules published as standalone packages start()no longer accepts global options; all runtime options live in each app'sconfiguration- Separated
unmount()fromunload():unmount()removes the view while keeping a short-lived instance cache, whereasunload()destroys the instance completely - Added
isRuntimeCompatible(),loadTimeout, andQiankunErrorwith stable error codes - Dropped IE support,
SnapshotSandbox, Shadow DOM style isolation, andinitGlobalState
Client-Side Streaming Rendering
Most web servers already stream HTML responses. Traditionally, that optimization relied on the server and only helped initial page loads; subsequent route transitions into micro-apps could not stream.
Before 3.0, qiankun's HTML Entry loader was serial as well. It waited for the full HTML response, extracted <link> and <script> tags with regular expressions, and finally fetched and executed scripts with eval. Even when the server streamed HTML, the client gained nothing from it.
3.0 rewrites @qiankunjs/loader around client-side streaming rendering. As chunks arrive from the HTML response stream, the loader incrementally parses and writes them into the micro-app container while virtualizing <head> as <qiankun-head>. Subsequent micro-app switches stream just like first-load pages:
This brings three main benefits:
- Better performance. External scripts and stylesheets are discovered and handled as soon as they appear in any incoming chunk, without waiting for the entire HTML document or scanning large strings with regexes—parsing now uses native
TreeWalker. In our 500 KB HTML benchmark, average render time dropped from 500 ms to 300 ms (~40% faster). Because streaming discovers and fetches assets early on its own, complex 2.xprefetchstrategies are largely unnecessary (prefetchAppsremains available but is marked deprecated). - Fewer bugs. Rather than executing scripts manually with
eval, the loader inserts processed<script>elements into the DOM for native browser execution. The sandbox no longer needs to emulatescript.onloadandscript.onerror, eliminating edge-case mismatches with browser behavior. Moving offevalalso eliminates memory leaks when DevTools is open and works under strict CSP policies that forbid'unsafe-eval'. - Streaming SSR & extensibility. Paired with server-side streaming SSR, both initial loads and sub-app transitions render progressively. The loader also exposes
streamTransformerandnodeTransformerhooks for transforming the HTML response stream during reads and rewriting DOM nodes before container insertion.
Note: 3.0 allows at most one external
<script>with theentryattribute per HTML Entry.@qiankunjs/bundler-pluginadds this attribute automatically so you don't have to edit HTML by hand.
Native ESM Sandbox
The most frequently asked question in 2.x was how to integrate Vite apps with qiankun.
2.x wrapped script source in with(proxy) and read lifecycles off window—an approach built for UMD and classic scripts. <script type="module">, however, always runs in strict mode (where with is a syntax error), has its own module scope, and naturally exports lifecycles from the entry module. Previously, integrating Vite required community workarounds or downgrading builds to UMD.
3.0 introduces a dedicated native ESM sandbox—with no iframes and no custom module loader. Module instantiation and evaluation stay in the browser's native ESM loader. qiankun steps in between source fetch and evaluation, using the pure-JS es-module-lexer to rewrite module source and mapping it via a dynamically injected <script type="importmap">:
The engine assigns each micro-app instance a monotonically increasing instanceKey, rewrites static specifiers to <instanceKey>/<url> in the dynamic import map, intercepts dynamic import() and import.meta, and destructures globals such as window and document from the instance's __qk_view at the top of each module. Multiple instances of the same micro-app keep separate module graphs and isolated global state. Everything runs through blob: modules, so CSP only needs blob:—no 'unsafe-eval'.
Because the browser handles module loading and evaluation natively, import/export, dynamic import(), top-level await, circular dependencies, and live bindings all work out of the box. With @qiankunjs/bundler-plugin/vite, both the Vite dev server and production builds plug straight in—just export lifecycle hooks from the entry module without UMD or window globals:
export async function bootstrap() {}
export async function mount({ container }: { container: HTMLElement }) {
render(container);
}
export async function unmount() {
root?.unmount();
}Note:
- The native ESM sandbox relies on browser support for dynamically injecting multiple import maps (Chrome / Edge 133+ or Safari 18.4+). Firefox does not enable this by default yet, and 3.0 does not ship a fallback shim. qiankun probes capabilities before loading ESM and throws
esm-unsupportedwhen unavailable; apps that must support Firefox can continue using classic builds.- When connecting to a Vite dev server, qiankun disables the micro-app's internal HMR connection to prevent full-page reloads from inside the sandbox, so refresh manually after edits. Also, top-level module code does not re-run on remount—create app instances and state in
mount, and tear them down inunmount.
Native CSS @scope Style Isolation
In 2.x, Shadow DOM (strictStyleIsolation) broke modals and dropdowns mounted onto document.body, while selector rewriting (experimentalStyleIsolation) still had edge cases it could not cover.
3.0 removes both modes and adopts native CSS @scope:
loadMicroApp(
{ name: 'catalog', entry: '//localhost:7100', container },
{ sandbox: { styleIsolation: true } },
);Micro-apps stay in the main document. Inline <style> tags, external stylesheets, and insertRule rules are wrapped in @scope ([data-name="<appName>"]), and static @keyframes names are automatically prefixed per app.
Note: Style isolation is off by default and one-way—it prevents micro-app styles from leaking out, without blocking host styles from affecting the micro-app. It requires native
@scopesupport (Chrome / Edge 118+, Safari 17.4+, or Firefox 146+) with no polyfill. Portals mounted outside the container remain outside the scope; mount them intoprops.containerinstead.
Standalone Sandbox & Companion Packages
Alongside the runtime itself, 3.0 ships three companion capabilities as standalone packages:
@qiankunjs/sandboxis the Proxy-membrane JS sandbox, enabled by default with IE support dropped. Even outside a micro-frontend architecture, you can import it standalone to isolate globals, timers, and event listeners of trusted third-party scripts.@qiankunjs/reactand@qiankunjs/vueship official<MicroApp />components. After 2.0 introducedloadMicroApp, most teams had to write their own wrapper component; 3.0 builds in loading and error boundary slots so micro-apps behave like regular components.@qiankunjs/bundler-pluginsupports both Webpack 4/5 and Vite, removing the need to hand-configurelibrary,libraryTarget,jsonpFunction, and related options.
3.0 also trims features outside a micro-frontend framework's scope. initGlobalState has been removed—pass your own store or event bus via props instead—and global options on start() now live at the application level.
Migration Highlights
Here are the most common changes when upgrading from 2.x to 3.0. For the full reference, see Migrating from qiankun 2.x.
1. entry as an HTML URL, container as an HTMLElement
registerMicroApps([
{
name: 'react-app',
- entry: { scripts: ['//localhost:7100/main.js'], styles: ['//localhost:7100/main.css'] },
+ entry: '//localhost:7100',
- container: '#subapp',
+ container: document.querySelector('#subapp')!,
activeRule: '/react',
},
]);2. Move options from start() to per-app configuration
-registerMicroApps(apps);
-start({
- prefetch: 'all',
- sandbox: { experimentalStyleIsolation: true },
- singular: true,
-});
+registerMicroApps(
+ apps.map((app) => ({
+ ...app,
+ configuration: {
+ sandbox: {
+ styleIsolation: true,
+ },
+ },
+ })),
+);
+start();3. Switch micro-apps to @qiankunjs/bundler-plugin
Webpack:
-const packageName = require('./package.json').name;
+const { QiankunWebpackPlugin } = require('@qiankunjs/bundler-plugin');
module.exports = {
output: {
- library: `${packageName}`,
- libraryTarget: 'umd',
- jsonpFunction: `webpackJsonp_${packageName}`,
- globalObject: 'window',
+ publicPath: 'auto',
},
+ plugins: [
+ new HtmlWebpackPlugin({ template: './src/index.html' }),
+ new QiankunWebpackPlugin(),
+ ],
};Vite:
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { qiankun } from '@qiankunjs/bundler-plugin/vite';
export default defineConfig({
plugins: [react(), qiankun()],
});4. unmount() vs unload()
3.0 caches instances loaded via loadMicroApp for a short window. unmount() removes the view and reuses the instance on the next mount; call unload() when you want to tear down the sandbox and release resources completely:
const app = loadMicroApp({ name: 'account-app', entry, container });
await app.mountPromise;
await app.unmount(); // Temporarily remove; reusable on remount
await app.unload(); // Destroy completelyTry It Out
Install:
npm i qiankunIf you use a coding agent such as Claude Code or Cursor, install the official Agent Skill to generate host and micro-app setups following 3.0 conventions:
npx skills add umijs/qiankunTo see it in action right away, visit the live demo at examples.qiankunjs.com. It includes both React and Vue hosts, micro-apps across multiple stacks, and a standalone sandbox demo where you can test global variables, timers, and style isolation directly.
Alongside 3.0, we also launched a redesigned logo and a standalone documentation site at www.qiankunjs.com, with refreshed tutorials, cookbooks, API references, error troubleshooting guides, and runtime internals. The previous site at qiankun.umijs.org redirects automatically, and the 2.x documentation remains archived at v2.qiankun.umijs.org. If you run into issues, feel free to open an issue on GitHub 👻.
- GitHub: https://github.com/umijs/qiankun
- Documentation: https://www.qiankunjs.com
- 2.x Docs Archive: https://v2.qiankun.umijs.org
- Live examples: https://examples.qiankunjs.com
- 3.0 Roadmap: https://github.com/umijs/qiankun/discussions/1378
Acknowledgements
Thank you to every contributor who helped build qiankun 3.x (in alphabetical order):
@aladdin-add @bravepg @chessl @gongshun @hakushinring @huangkevin-apr @ice-zjchen @internettrans @linghaoSu @nayonglin @officialasishkumar @qiongshusheng @qiYuei @wanghangit
