Vite integration covers the setup that works. This page covers two ways it breaks once it moves into a real workspace.
Always import the plugin by its bare specifier
Import @loom-dev/preview/vite and nothing else:
// correctimport { loomPreview } from "@loom-dev/preview/vite";
// broken — do not do thisimport { loomPreview } from "../loom/packages/preview/src/vite.ts";The plugin finds the modules it aliases relative to its own file. A path import lets Vite bundle the plugin into a temporary file inside your project, which moves that anchor. The config still loads, and the build fails later with an error that looks unrelated:
[commonjs--resolver] Failed to resolve entry for package "@loom-dev/layout".The package may have incorrect main/module/exports specified in its package.json.Don’t merge this into an app that also uses React
loomPreview() changes the whole Vite config it lives in, not just your Roblox files:
- It aliases bare
react,react/jsx-runtimeandreact/jsx-dev-runtimeto loom’s own React 18. - It sets
esbuild.jsx: "automatic"for every module.
Add it to an existing React web app’s config and that app gets loom’s React 18. A React 19 app
breaks, and alongside @vitejs/plugin-react you get two JSX transforms fighting.
Keep the preview in its own Vite instance. Any of these works:
- A dedicated preview app in your workspace, with its own
vite.config.tsand dependencies. A config holding onlyloomPreview()is enough. - No Vite project at all.
loom previewandloom buildignore your project’s Vite config, so they can’t collide with it. - Mounted inside your app’s dev server with
loom-dev/embed. The gallery still runs in its own Vite instance, so the two module graphs never meet.
An Astro integration mounts the gallery in dev and emits the static bundle at build. Putting
loomPreview() in astro.config.mjs would replace the site’s own React 19.
When something breaks
Every error string, including the runtime ones, is in Troubleshooting.