-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Open
Description
Tesseract.js version 5.1.1
Describe the bug
Tesseract.js doesn't work on Cloudflare because it make it as browser env.
To Reproduce
Steps to reproduce the behavior:
- install Tesseract on cloudflare sample project and just run.
- the log is:
✘ [ERROR] ReferenceError: Worker is not defined
at module.exports
(file:///Users/xxx/Workspace/WebstormProjects/podcast-backend/node_modules/.pnpm/[email protected]/node_modules/tesseract.js/src/worker/browser/spawnWorker.js:14:5)
at module.exports [as createWorker]
(file:///Users/xxx/Workspace/WebstormProjects/podcast-backend/node_modules/.pnpm/[email protected]/node_modules/tesseract.js/src/createWorker.js:46:16)
at workerGen
(file:///Users/xxx/Workspace/WebstormProjects/podcast-backend/src/index.ts:33:34)
at Array.<anonymous>
(file:///Users/xxx/Workspace/WebstormProjects/podcast-backend/src/index.ts:16:15)
at Hono2.dispatch
(file:///Users/xxx/Workspace/WebstormProjects/podcast-backend/node_modules/.pnpm/[email protected]/node_modules/hono/dist/hono-base.js:187:37)
at Hono2.fetch
(file:///Users/xxx/Workspace/WebstormProjects/podcast-backend/node_modules/.pnpm/[email protected]/node_modules/hono/dist/hono-base.js:213:17)
at fetchDispatcher
(file:///Users/xxx/Workspace/WebstormProjects/podcast-backend/.wrangler/tmp/bundle-2Cuv2V/middleware-loader.entry.ts:54:17)
at __facade_invokeChain__
(file:///Users/xxx/Workspace/WebstormProjects/podcast-backend/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/wrangler/templates/middleware/common.ts:53:9)
at Object.next
(file:///Users/xxx/Workspace/WebstormProjects/podcast-backend/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/wrangler/templates/middleware/common.ts:50:11)
at jsonError
(file:///Users/xxx/Workspace/WebstormProjects/podcast-backend/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/wrangler/templates/middleware/middleware-miniflare3-json-error.ts:22:30)
Please attach any input image required to replicate this behavior.
Expected behavior
It should be treat as node env but now is browser.
Device Version:
- OS + Version: macOS 14.6.1 (23G93)
Additional context
Add any other context about the problem here.
notAunty, Kycermann, roma-dealpos and ItsWendell
Metadata
Metadata
Assignees
Labels
No labels