Skip to content

Commit 12dbc06

Browse files
committed
Update worker path resolution in client utility to accurately reflect utils subdirectory for both ESM and CommonJS environments
1 parent 4fc2dbf commit 12dbc06

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/utils/client.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ function getWorkerPath(): string {
2020
const workerFile = isESM ? 'worker.mjs' : 'worker.cjs';
2121

2222
if (isESM && import.meta?.url) {
23-
// ESM: same directory as current file
23+
// ESM: current file is bundled in dist/index.mjs, worker is in dist/utils/
2424
const currentDir = path.dirname(fileURLToPath(import.meta.url));
25-
return path.resolve(currentDir, workerFile);
25+
return path.resolve(currentDir, 'utils', workerFile);
2626
} else if (!isESM) {
27-
// CJS: same directory as current file
28-
return path.resolve(__dirname, workerFile);
27+
// CJS: current file is bundled in dist/index.cjs, worker is in dist/utils/
28+
return path.resolve(__dirname, 'utils', workerFile);
2929
} else {
3030
// Fallback: assume utils subdirectory in dist
3131
return path.resolve(path.dirname(process.argv[1] ?? ''), 'utils', workerFile);

0 commit comments

Comments
 (0)