Installation
Install from npm. Free for evaluation, personal projects, and education.
Install revise from npm (no account or registry token required):
npm i revisepnpm add reviseyarn add revise yjs y-protocolsnpm and pnpm install peer dependencies (react, react-dom, yjs, y-protocols) automatically; Yarn requires listing yjs and y-protocols explicitly. revise/server is bundled in revise.
Free for evaluation, personal noncommercial projects, and education. Production use by businesses, nonprofits, and government requires a commercial license.
Entry points#
| Import | Description |
|---|---|
revise | React editor (import ReviseEditor from "revise"). |
revise/full | Same editor plus Tree-sitter syntax highlighting and wasmHotPaths acceleration. Not CSP-safe. |
revise/style.css | Editor stylesheet. Import once. |
revise/version | Build identity (REVISE_SDK_VERSION, REVISE_SDK_BUILD) with no runtime weight. |
revise/server | Node API, bundled in revise and covered by the SDK license. |
Peer dependencies and runtime#
- Browser editor: Requires React 18+,
react-dom18+,yjs(^13.6.0), andy-protocols(^1.0.6). Every session uses Yjs even without a collaboration provider; your bundler must resolve a single copy ofyjs. Node 18+ for build tooling. revise/server: ESM only, Node 20+. Does not import React;jsdomis declared as a direct dependency ofrevise, so no separate install is needed. The browser entry never importsrevise/server.
Bundle size#
The main editor chunk is ~2.7 MB minified (~800 KB gzipped). Format converters, PDF export, math rendering, and locales are code-split and load on demand. Load the editor lazily rather than in your entry bundle (load on demand).
To silence Vite's 500 kB chunk warning:
export default defineConfig({
build: { chunkSizeWarningLimit: 3000 },
});Versioning#
revise follows semver. Pin an exact version in package.json and review CHANGELOG.md before upgrading:
{
"dependencies": {
"revise": "4.6.0"
}
}Upgrade from an earlier version#
Earlier releases shipped as @reviseio/editor. Replace the dependency with revise and update import paths (component props and handle APIs are unchanged):
npm uninstall @reviseio/editor
npm i revise@4.6.0pnpm remove @reviseio/editor
pnpm add revise@4.6.0yarn remove @reviseio/editor
yarn add revise@4.6.0| Earlier import | Current import |
|---|---|
@reviseio/editor, revise/editor | revise |
@reviseio/editor/full, revise/editor/full | revise/full |
@reviseio/editor/version | revise/version |
@reviseio/editor/style.css | revise/style.css |
@reviseio/editor/server | revise/server |
Update any bundler references (such as Vite's optimizeDeps.exclude) to "revise". Earlier version docs remain in the version selector.
Server-side code#
Server-side code uses revise/server, built around ReviseDocument:
| Earlier | revise/server |
|---|---|
createServerDocumentSession(ydoc) | ReviseDocument.fromYDoc(ydoc), then doc.tools |
parseDocument, documentToDocx, fileToYDoc | ReviseDocument.open(file), doc.export({ format: "docx" }), doc.ydoc |
exportDocument(room, { mode }), ydocToDocx(room) | ReviseDocument.fromYDoc(room), then doc.export({ format, mode }) |
seedYDocFromFile(room, bytes, filename) | seedYDoc(room, { bytes, filename }) |
encodeYDoc, decodeYDoc | Y.encodeStateAsUpdate(doc.ydoc); ReviseDocument.restore(update) |
When porting: await ReviseDocument methods, check result.ok on tool calls instead of catching, and write bytes from doc.export(). doc.snapshot() uses Revise's own format; use Y.encodeStateAsUpdate(doc.ydoc) for Yjs transports.
Report a problem#
Attach version and build constants to error reports:
import { REVISE_SDK_VERSION, REVISE_SDK_BUILD } from "revise/version";
// "4.4.0", "f7dc7173"Run npm bugs revise or see support.
Assets#
PDF export WebAssembly and PDF import worker/codecs are bundled directly inside revise and served from your own build automatically (and read from disk in revise/server).
Optional static assets load on demand from https://revise.io by default:
fonts/— fallback PDF export fonts (including CJK and world scripts) when installed/local fonts cannot be embeddedkatex.min.css— math stylesheet and KaTeX fontstree-sitter/— syntax grammars (revise/fullonly)
Under a strict CSP, allow https://revise.io in connect-src, font-src, and style-src—or self-host them with the optional @reviseio/assets package:
# Copies fonts/ and katex.min.css into your static public directory
npx @reviseio/assets copy public/revise
# Optional flags: --tree-sitter (for revise/full), --no-cjk (skip ~22 MB CJK fonts)Then call setAssetBaseUrl() once at startup:
import { setAssetBaseUrl } from "revise";
setAssetBaseUrl("/revise");@reviseio/assets is optional—pass setAssetBaseUrl(false) to disable remote asset fetches entirely if you rely on installed/web fonts and don't need KaTeX or Tree-sitter. See production deployment for the full zero-egress checklist.
Troubleshooting#
ERESOLVE peer dependency errors
revise requires React 18 or newer; React 17 and earlier are unsupported.
Unexpected content type in insert operation
Multiple copies of yjs are bundled. Deduplicate yjs in your bundler (for example, resolve.dedupe: ["yjs", "y-protocols"] in Vite).