isolet Widget Isolation
Skill by ara.so — Daily 2026 Skills collection.
isolet-js packages any component (React, Solid, Svelte, vanilla JS, etc.) into a self-contained, isolated widget. Widgets render inside shadow DOM by default, so styles are fully scoped. Output formats include IIFE (script tag), ESM, and CommonJS.
Install
Core API: createIsolet
Framework Adapters
React
Vanilla JS
Solid
Svelte
Isolation Modes
CLI
Config File
Multiple Widgets
CSS & Asset Handling
The build pipeline handles everything automatically:
stylesin config → CSS is read,url()references (fonts, images) inlined as data URIs, result available as__ISOLET_CSS__in your entry.cssimports → converted to JS string exports (shadow DOM safe)- Asset imports (
.png,.woff2,.mp3, etc.) → inlined as data URIs styles: "./path.css"increateIsolet→ resolved and inlined at build time
Or reference the CSS path directly (auto-resolved at build time):
Manual Vite Plugin Setup
If using Vite directly instead of the CLI:
Script Tag (IIFE) Usage
For a bundled custom widget via IIFE:
Common Patterns
Lazy-mount on demand
z-index overlay widget
Reactive props updates
Troubleshooting
Styles leaking in or out
Use isolation: "shadow-dom" (default). Verify your css option or styles path is correctly set — without CSS in the shadow root, the host page styles will not apply inside.
__ISOLET_CSS__ is undefined
This variable is only injected by the isolet build CLI when styles is set in config. For manual Vite builds, add autoStylesPlugin() to your Vite config.
Component not rendering
Ensure the mount function appends to container, not to document.body. In shadow DOM mode, the container is inside the shadow root.
Cleanup not running
Return a cleanup function from your mount callback. Without it, widget.unmount() cannot tear down framework internals (timers, subscriptions, etc.).
IIFE global not found
Check globalName in config matches what you reference in HTML. The runtime core exposes globalThis.__ISOLET__ when no globalName is set.
External deps not found at runtime
If you set external: ["react"], the host page must provide React globally or via module federation before your widget script loads.


