Wujie injects the $wujie object into every sub-app, accessible via $wujie or window.$wujie.
$wujie
Type:
typescript{ bus: EventBus; shadowRoot?: ShadowRoot; props?: { [key: string]: any }; location?: Object; }
$wujie.bus
Same as bus.
$wujie.shadowRoot
- Type: ShadowRoot
The Shadow DOM root where the sub-app is rendered.
$wujie.props
- Type:
{ [key: string]: any }
Data and callbacks injected by the main app.
$wujie.location
Type:
ObjectBecause the sub-app's
iframeruns on the main app's origin, nativelocation.hostreturns the main app's host. Wujie exposes the sub-app's truelocationon$wujie.location.For
Vitesub-apps (whose scripts usetype="module"), Wujie cannot wrap ES module scripts in a closure to proxylocation. Replace all references towindow.location.hostwith$wujie.location.hostin Vite sub-apps.When a sub-app runs in Degrade Mode,
Proxyis unavailable andlocationcannot be proxied. Replace references towindow.location.hostwith$wujie.location.host.For non-Vite sub-apps running in standard mode, Wujie proxies
window.locationautomatically, so no code changes are required.
