bun-plugin-comlink
v0.0.6
Published
That is [comlink](https://github.com/GoogleChromeLabs/comlink) loader for Workers in [Bun](https://bun.sh).
Readme
bun-plugin-comlink
That is comlink loader for Workers in Bun.
Installation
bun add bun-plugin-comlinkCreate a plugin.ts file:
import { plugin } from "bun";
import comlinkPlugin from "bun-plugin-comlink";
await plugin(comlinkPlugin());Add plugin.ts to bunfig.toml:
preload = ["./plugin.ts"]Usage
Create a functions.worker.ts file:
export async function sayHello() {
return "Hello from worker!";
}So later you can import it in your main file:
import { sayHello } from "./functions.worker";
console.log(await sayHello());Limitations
- You can't have sync functions with comlink
License
Apache-2.0
