X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=examples%2Ftypescript%2Fpool.ts;h=a53857c0f311a63ff321b4ce08b9e1ef02465dcd;hb=1adc6af72c087b9412e625bc9576be67d40e7397;hp=54b437ab31b2f1d7785439c5ce9007167e554331;hpb=d66d8d9da006e36000bc019b4688d69953e7a52f;p=poolifier.git diff --git a/examples/typescript/pool.ts b/examples/typescript/pool.ts index 54b437ab..a53857c0 100644 --- a/examples/typescript/pool.ts +++ b/examples/typescript/pool.ts @@ -1,4 +1,5 @@ -import { join } from 'path' +import { dirname, join } from 'path' +import { fileURLToPath } from 'url' import type { MyData, MyResponse } from './worker' import { DynamicThreadPool, @@ -8,7 +9,7 @@ import { export const fixedPool = new FixedThreadPool>( availableParallelism(), - join(__dirname, 'worker.js'), + join(dirname(fileURLToPath(import.meta.url)), 'worker.js'), { errorHandler: (e: Error) => { console.error(e) @@ -22,7 +23,7 @@ export const fixedPool = new FixedThreadPool>( export const dynamicPool = new DynamicThreadPool>( Math.floor(availableParallelism() / 2), availableParallelism(), - join(__dirname, 'worker.js'), + join(dirname(fileURLToPath(import.meta.url)), 'worker.js'), { errorHandler: (e: Error) => { console.error(e)