The same bridge, no native code: the parent page is the host (one BridgeHost + IframeHostAdapter per iframe, shared ConnectionRegistry) and each iframe is a client (BridgeClient + IframeClientAdapter).
pnpm --filter @example/iframe dev # http://localhost:5177This is the iframe-isolation integration style: each frame is a separate window/JS context, independently bundled and deployed (cross-origin works — that's what the adapters' origin parameters are for), and the only channel between them is string postMessage. That hard boundary is exactly the condition under which webview-ts applies.
It is not Module Federation-style micro-frontend composition. There, remote bundles are loaded into the same JS context — window and heap are shared, modules import each other directly, and there is no message boundary for a bridge to type. If your MFE architecture is MF/single-spa-style, you don't need webview-ts between remotes.
Where iframe isolation is chosen deliberately — payment widgets, third-party/partner embeds, security boundaries, embedding a legacy app — this example is the template.
- Adapter pair = platform — the iframe adapters ship in
@webview-ts/core(IframeClientAdapter/IframeHostAdapter, ~40 lines each); the client side plugs in viaBridgeConfig.adapter, the host side viacreateBridgeHost({ adapter }). A custom platform is the same shape — see the custom-adapters docs. - Contract-first, transport-agnostic —
src/plugins.tsis the samedefinePlugincontract the mobile examples use; typed calls (shell.getUser) and events (shell.themeChanged) flow throughwindow.postMessageinstead of a WebView channel. - Multi-frame routing — "Broadcast theme toggle" reaches both frames via
TARGET.BROADCAST; "Ping frame-B only" targets one frame through the registry while the other stays silent. - Fallback mode — open
/child.htmldirectly (no shell) and the plugin's mocks take over, exactly like browser-only development against a native app. - Origin/source checks — both adapters verify
event.originandevent.source, so two frames' traffic can't cross and foreign frames can't spoof bridge messages.