From e8cd0d2f97e0c63f4f8e31805afd8449ef4a0460 Mon Sep 17 00:00:00 2001 From: Ulrich Sossou Date: Tue, 25 Jun 2024 08:53:32 +0100 Subject: [PATCH] fix(worker): get dirname by fileURLToPath --- src/classes/worker.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/classes/worker.ts b/src/classes/worker.ts index 3a68feb40c..2708dcd6ab 100644 --- a/src/classes/worker.ts +++ b/src/classes/worker.ts @@ -1,5 +1,5 @@ import * as fs from 'fs'; -import { URL } from 'url'; +import { fileURLToPath, URL } from 'url'; import { Redis } from 'ioredis'; import * as path from 'path'; import { v4 } from 'uuid'; @@ -260,7 +260,7 @@ export class Worker< } // Separate paths so that bundling tools can resolve dependencies easier - const dirname = path.dirname(module.filename || __filename); + const dirname = path.dirname(fileURLToPath(import.meta.url) || __filename); const workerThreadsMainFile = path.join(dirname, 'main-worker.js'); const spawnProcessMainFile = path.join(dirname, 'main.js');