fix(apis/websocket): don't bundle tesseract.js

This commit is contained in:
PalmDevs
2024-06-24 23:33:31 +07:00
parent 3b2596e748
commit 51a6fb65f0
5 changed files with 13 additions and 29 deletions

View File

@@ -1,19 +0,0 @@
diff --git a/src/worker/node/defaultOptions.js b/src/worker/node/defaultOptions.js
index 053c1e3e3b561b2e5b5e3609e9c6b509b1661f11..407242f5576f8d888644ab28ff169599a79bf4dd 100644
--- a/src/worker/node/defaultOptions.js
+++ b/src/worker/node/defaultOptions.js
@@ -1,10 +1,13 @@
const path = require('path');
+const fs = require('fs');
const defaultOptions = require('../../constants/defaultOptions');
+const defaultPath = path.join(import.meta.dir, '..', '..', 'worker-script', 'node', 'index.js')
+
/*
* Default options for node worker
*/
module.exports = {
...defaultOptions,
- workerPath: path.join(__dirname, '..', '..', 'worker-script', 'node', 'index.js'),
+ workerPath: fs.existsSync(defaultPath) ? defaultPath : path.join(import.meta.dir, 'tesseract.js', 'src', 'worker-script', 'node', 'index.js'),
};