Skip to content

@typst-wasm/vite-plugin-typst

@typst-wasm/vite-plugin-typst transforms explicit ?typst=html imports into modules containing compiled HTML and document metadata.

Terminal window
npm install @typst-wasm/vite-plugin-typst typst-wasm

Register the plugin in vite.config.ts:

import typst from "@typst-wasm/vite-plugin-typst";
export default {
plugins: [typst()],
};

The plugin supplies Node/Vite defaults for the worker and the three core WASM modules. Custom coreModules and worker options remain available when your build or deployment needs different asset resolution.

Import a Typst document:

/// <reference types="@typst-wasm/vite-plugin-typst/client" />
import document from "./post.typ?typst=html";
const html = document.html;

The plugin currently supports HTML output only. See the getting started guide or the API reference.