Loomguides

Troubleshooting

Find the fix by symptom, from blank previews to missing globals and duplicate React.

Quick index

SymptomCauseFix
Blank page, [loom] nothing mounted into #loom-root after 2sEntry exports instead of mountingCall createRoot().render(...) at top level
ReferenceError: UDim2 is not defined in a built pageThe plugin couldn’t find your entryimport "@loom-dev/preview/globals" first in the entry
Invalid hook call / two React copiesStale optimizer cache, or React 19rm -rf node_modules/.vite; pin React 18
Failed to resolve entry for package "@loom-dev/layout"Plugin imported by file pathImport @loom-dev/preview/vite
no index.html and no client entry foundNo entry under the rootPass entry, or targets for a gallery
no targets matched … — nothing to buildGlob missed, or unsupported glob syntaxOnly **, **/ and * are supported
Package "…" only provides a Lua/Luau runtimeA declaration-only roblox-ts packageAdd a shims entry
RollupError: Expected ';', '}' or <eof> in a .luau file, build onlySame as above, reached only by the buildSame as above
Renders, but looks wrongUnimplemented propertyCheck Supported properties
Text or buttons spill out of their containerContent wider than the parentExpected: AutomaticSize is bounded by the parent
Runs off the edge on a phoneThe scene lays out against the real viewportAdd ?base=960; see Previews on a phone
no face is loaded for the Roblox font family "…"A font loom can’t ship, such as GothamRegister your own copy
A list orders itself alphabeticallySortOrder defaults to Name, as in StudioSet SortOrder={Enum.SortOrder.LayoutOrder}
You can’t tell what a preview is doingOpen the debug panel: ?debug=1 or Ctrl+Alt+D

Blank page: nothing mounted

[loom] nothing mounted into #loom-root after 2s — does your entry call
createRoot().render(<App />) at the top level?

Loom loaded, but your entry rendered nothing. Usually the entry exports a component instead of rendering it:

src/main.client.tsx
import { createRoot } from "@rbxts/react-roblox";
import { App } from "./App";
createRoot().render(<App />);

If that’s already there, loom may have picked a different entry. It uses the first match from a fixed list, so src/main.client.tsx wins over src/main.tsx. Pass loomPreview({ entry }) to choose.

ReferenceError: UDim2 is not defined

The Roblox globals weren’t installed before your code ran.

  • In a built page: the plugin couldn’t find your entry, for example because of a custom build.rollupOptions.input. Import the globals first in the entry:

    import "@loom-dev/preview/globals";
  • In the dev server: an inline <script type="module"> in index.html runs first. Move that code into the entry module.

Two copies of React

Warning: Invalid hook call or “more than one copy of React” means two React instances are loaded. Check, in order:

  1. Stale cache. Run rm -rf node_modules/.vite and restart.
  2. React 19. The preview renderer needs React 18. Pin React 18 in the preview project.
  3. Shared Vite config. loomPreview() was added to an app with its own React. Give the preview its own Vite project; see Vite integration.

Failed to resolve entry for package "@loom-dev/layout"

Import the plugin by its package name, never by file path:

import { loomPreview } from "@loom-dev/preview/vite";

no index.html and no client entry found

You probably pointed loom at a workspace root instead of an app. Point at the app folder, pass loomPreview({ entry }), or use gallery mode with --targets.

no targets matched … — nothing to build

A bare directory means <dir>/**/*.loom.tsx. Globs support only **, **/ and *: no braces, ?, or negation. node_modules and dot-folders are skipped.

A scene renders but looks wrong

Check the property in Supported properties first. Some props are typed but not drawn, such as UIGradient.Offset and ScrollBarImageTransparency. Tiled sprite sheets aren’t supported; loom warns when it sees one.

Text is a different size than expected

loom: no face is loaded for the Roblox font family "Gotham" — its text is painted
and measured in the system fallback instead, …

A missing font changes layout, not just appearance, because text is measured to size and wrap it. Loom ships 28 Roblox font families. A few, including Gotham and BuilderSans, can’t be redistributed, so register your own copy. See Fonts.

The debug panel’s fonts section shows which fonts actually loaded.

Content spills out of its container

AutomaticSize grows only as wide as the parent allows, as in Roblox. Height isn’t capped. Content that can’t shrink, such as a long word or a row of buttons, overflows the same way it does in Studio. Give the parent more room, or let the text wrap.

A target throws but the page still works

Intended. In a gallery, each target has its own error boundary. Errors show as a red panel with a stack trace, and the sidebar keeps working.