-import { join } from 'path'
+import { dirname, join } from 'path'
+import { fileURLToPath } from 'url'
import type { MyData, MyResponse } from './worker'
import {
DynamicThreadPool,
export const fixedPool = new FixedThreadPool<MyData, Promise<MyResponse>>(
availableParallelism(),
- join(__dirname, 'worker.js'),
+ join(dirname(fileURLToPath(import.meta.url)), 'worker.js'),
{
errorHandler: (e: Error) => {
console.error(e)
export const dynamicPool = new DynamicThreadPool<MyData, Promise<MyResponse>>(
Math.floor(availableParallelism() / 2),
availableParallelism(),
- join(__dirname, 'worker.js'),
+ join(dirname(fileURLToPath(import.meta.url)), 'worker.js'),
{
errorHandler: (e: Error) => {
console.error(e)