mirror of
https://github.com/dream-num/univer.git
synced 2026-10-02 04:24:34 +08:00
@univerjs/rpc-node
@univerjs/rpc-node provides the Node.js counterpart for Univer RPC scenarios, allowing main-thread and worker-side plugins to communicate outside the browser.
Package Overview
| Package | UMD global | CSS | Locales | Facade entry |
|---|---|---|---|---|
@univerjs/rpc-node |
UniverRpcNode |
No | No | No |
Installation
pnpm add @univerjs/rpc-node
# or
npm install @univerjs/rpc-node
Keep all @univerjs/* packages on the same version.
Usage
import { fileURLToPath } from 'node:url';
import { UniverRPCNodeMainPlugin } from '@univerjs/rpc-node';
const workerSrc = fileURLToPath(new URL('./worker.js', import.meta.url));
univer.registerPlugin(UniverRPCNodeMainPlugin, { workerSrc });
The referenced worker module must create its own Univer instance and register UniverRPCNodeWorkerPlugin; see the Node.js worker example.
Exported plugin classes:
UniverRPCNodeMainPluginUniverRPCNodeWorkerPlugin