Skip to main content

Install

Peer Dependencies

@mujoco/mujoco is installed by mujoco-react as the underlying MuJoCo WASM engine.

TypeScript

mujoco-react ships with full TypeScript types. No @types/ package needed for the library itself.

Bundler Setup

@mujoco/mujoco ships a .wasm asset. Vite serves package WASM assets correctly with the standard React setup:

Next.js

Since MuJoCo uses WASM and browser APIs, it must run client-side only:

Create React App

Works out of the box. No additional configuration needed.

Multi-Threaded WASM

MujocoProvider defaults to the single-threaded official MuJoCo WASM build. To opt into the official multi-threaded build:
"auto" only loads the threaded build when threadedLoader and mtWasmUrl are provided and the browser reports globalThis.crossOriginIsolated === true. If you force wasmVariant="threaded", your dev server and production host must send:

Verify Installation

If you see a Franka Panda robot in your browser, everything is working.
The first load may take a few seconds as the WASM module initializes and model assets are fetched from GitHub. Subsequent loads are faster due to browser caching.