canvaskit-wasm 0.39
build 2026-04-29
CanvasKitInitOptions
The plain object you pass to the default-exported CanvasKitInit function from canvaskit-wasm. It tells the loader where to fetch the .wasm file from. The signature is:
import CanvasKitInit from 'canvaskit-wasm';
const CK: CanvasKit = await CanvasKitInit({
locateFile: (file) => `/static/${file}`,
});
locateFile is the only field. It's called once with 'canvaskit.wasm' (and again for any other file the loader needs); your job is to return a URL the browser can fetch().
Fields
| Field | Type | Notes |
|---|---|---|
locateFile | (file: string) => string | Resolve a filename to a URL. Required. |
See also
- Bundler integration — Vite / Webpack / Next.js / Bun examples for hooking up
locateFile. CanvasKit— what the resolved promise gives you.