Web Workers

Bases can move formula calculation to a Worker1 through RPC. Set notExecuteFormula: true on the main-thread formula engine, and register the remote Bases plugin with the calculating engine in the Worker.

Start with installation and basic usage. The following snippets extend that setup. Register the plugins before creating or loading content; replace existing registrations rather than registering a plugin twice.

Main thread

TypeScript
import { UniverProFormulaEnginePlugin } from '@univerjs-pro/engine-formula'import { UniverRPCMainThreadPlugin } from '@univerjs/rpc'univer.registerPlugin(UniverRPCMainThreadPlugin, {  workerURL: new Worker(new URL('./worker.ts', import.meta.url), { type: 'module' }),})univer.registerPlugin(UniverProFormulaEnginePlugin, { notExecuteFormula: true })

Worker entry

TypeScript
import { UniverRemoteBasesPlugin } from '@univerjs-pro/bases'import { UniverProFormulaEnginePlugin } from '@univerjs-pro/engine-formula'import { UniverLicensePlugin } from '@univerjs-pro/license'import { LocaleType, Univer } from '@univerjs/core'import { UniverRPCWorkerThreadPlugin } from '@univerjs/rpc'const univer = new Univer({ locale: LocaleType.EN_US })univer.registerPlugin(UniverLicensePlugin, { license: 'your license.txt' })univer.registerPlugin(UniverProFormulaEnginePlugin)univer.registerPlugin(UniverRemoteBasesPlugin)univer.registerPlugin(UniverRPCWorkerThreadPlugin)

Use a module Worker and a separate entry file. Keep the Worker and main-thread package versions aligned. Rendering and user interaction stay on the main thread.

Pivot views and dashboards

For dashboard pivot calculation, set notExecuteCalculation: true on the main-thread UniverBaseDashboardPlugin, and register UniverRemoteBaseDashboardPlugin in the same Worker. Keep the dashboard UI plugins on the main thread.

TypeScript
import { UniverBaseDashboardPlugin } from '@univerjs-pro/bases-dashboard'univer.registerPlugin(UniverBaseDashboardPlugin, { notExecuteCalculation: true })
TypeScript
import { UniverRemoteBaseDashboardPlugin } from '@univerjs-pro/bases-dashboard'univer.registerPlugin(UniverRemoteBaseDashboardPlugin)

Footnotes

  1. A Web Worker runs JavaScript outside the browser’s main thread and exchanges messages with it. It cannot access the page DOM directly; moving calculations into a Worker does not move the editor UI there. ↩

How is this guide?

© 2026 DreamNum Co., Ltd.