Understand the Preview Renderer architecture
mainThe LlamaCoder preview renderer is a browser-only runtime that uses esbuild-wasm to compile generated application files directly in the user's browser. It operates within a sandboxed iframe and uses import maps to resolve dependencies.
Resolution logic:
- Static preview substrate: Resolved via import maps to prebuilt files located in
/public/preview-vendor. - Dynamic npm packages: Any non-static allowed npm packages fall back to pinned
esm.shURLs.
This architecture allows for modern library support (e.g., Recharts, Radix, framer-motion), better error reporting via a custom bridge, and detailed performance timing (bundle time, runtime import/render time, and total time to ready).