fix(apis/websocket): also include tesseract core files in build

This commit is contained in:
PalmDevs
2024-07-23 00:43:26 +07:00
parent 55631b220f
commit 7dfbf6c92c
2 changed files with 13 additions and 4 deletions

View File

@@ -53,11 +53,14 @@ export interface WitMessageResponse {
}>
}
const TesseractWorkerPath = joinPath(import.meta.dir, 'worker', 'index.js')
const TesseractCompiledWorkerExists = await pathExists(TesseractWorkerPath)
const TesseractWorkerDirPath = joinPath(import.meta.dir, 'worker')
const TesseractWorkerPath = joinPath(TesseractWorkerDirPath, 'index.js')
const TesseractCorePath = joinPath(TesseractWorkerDirPath, 'core')
export const tesseract = await createTesseractWorker(
'eng',
OEM.DEFAULT,
TesseractCompiledWorkerExists ? { workerPath: TesseractWorkerPath } : undefined,
(await pathExists(TesseractWorkerDirPath))
? { workerPath: TesseractWorkerPath, corePath: TesseractCorePath }
: undefined,
)