What problem does it solve?
PixiJS commonly assumes a standard browser environment, so it breaks in Web Workers, OffscreenCanvas setups, Node/SSR, and CSP-restricted contexts where DOM access and eval-based compilation aren’t available.
Core Features & Use Cases
- Adapter-based non-browser execution: Use
DOMAdapter.set(...) to route all DOM/canvas/Image/XML/fetch work through the right adapter for the environment.
- Environment-specific imports: Load curated PixiJS bundles like
pixi.js/browser or pixi.js/webworker to avoid DOM-only modules when you need static module registration.
- Web Worker + OffscreenCanvas bootstrapping: Transfer an OffscreenCanvas from the main thread and initialize PixiJS inside the worker with
WebWorkerAdapter.
- Strict CSP compatibility: Preload the CSP polyfill via
pixi.js/unsafe-eval to remove reliance on eval/new Function during shader compilation and sync.
- Custom Adapter for Node/SSR/headless: Implement the full
Adapter interface to make PixiJS run in headless testing or server rendering.
Quick Start
Use this skill by calling DOMAdapter.set(WebWorkerAdapter) before creating new Application() in your worker, then initialize with app.init({ canvas, width, height }) using an OffscreenCanvas passed from the main thread.