Skip to main content
meow supports node:worker_threads for offloading work to separate JavaScript contexts. The API is the standard Node one — Worker, parentPort, workerData, postMessage, terminate — so existing worker code and libraries like jest-worker run unmodified.
Workers are a node-compat feature: node:worker_threads is part of the Node surface and is withdrawn in strict-web.

The cooperative-isolate model

Under the hood, meow’s workers are distinct V8 isolates that interleave cooperatively on the same OS thread, driven by the runtime’s event loop — not OS threads. This is a deliberate design choice. V8 isolates can’t move between OS threads, so rather than pay the context-switching tax of true OS threads, meow spawns each worker as a task on the main thread’s executor. They share nothing but the message channel, get genuine memory isolation, and interleave without thread overhead — ideal for the bursty, message-driven parallelism that bundlers and test runners use.
Main isolate  ──postMessage──▶  Worker isolate
     ▲                               │
     └──────────  message  ──────────┘

Example

import { Worker } from "node:worker_threads";

const worker = new Worker(new URL("./worker.ts", import.meta.url), {
  workerData: { n: 42 },
});

worker.on("message", (result) => {
  console.log("worker said:", result);
  worker.terminate();
});

worker.postMessage("start");

What’s supported

FeatureStatus
new Worker(specifier, { workerData })
worker.postMessage() / worker.on("message")✅ (structured-clone serialized)
parentPort.postMessage() / parentPort.on("message")
workerData
worker.terminate()✅ (terminates the isolate)
Error propagation worker → host✅ (surfaces as an Error)
Nested workers (a worker spawning its own worker)⚠️ inert for now
Each worker reuses the project’s resolver and module graph, so imports resolve exactly as they do on the main isolate, and inherits the run’s determinism configuration.
Because workers share the event loop rather than the CPU, they’re perfect for I/O-bound and message-driven concurrency. For CPU-bound hashing and tarball work, meow already offloads to background OS threads internally — you don’t need a worker for that.

Next: environment variables

Every MEOW_* variable and how process.env behaves per mode.