web-llm-chat icon indicating copy to clipboard operation
web-llm-chat copied to clipboard

[Bug] Web Worker Reference error

Open DeepAlien890 opened this issue 9 months ago • 0 comments

Bug Description

I tried to run latest code locally on my end but got the reference error when loading pages.

ReferenceError: Worker is not defined
    at new WebLLMApi (webpack-internal:///(ssr)/./app/client/webllm.ts:35:97)
    at Timeout.eval [as _onTimeout] (webpack-internal:///(ssr)/./app/components/home.tsx:269:23)
    at listOnTimeout (node:internal/timers:569:17)
    at process.processTimers (node:internal/timers:512:7)
 ⨯ app\client\webllm.ts (64:14) @ Worker
 ⨯ uncaughtException: ReferenceError: Worker is not defined
    at new WebLLMApi (webpack-internal:///(ssr)/./app/client/webllm.ts:35:97)
    at Timeout.eval [as _onTimeout] (webpack-internal:///(ssr)/./app/components/home.tsx:269:23)
    at listOnTimeout (node:internal/timers:569:17)
    at process.processTimers (node:internal/timers:512:7)
  62 |         type: "webWorker",
  63 |         engine: new WebWorkerMLCEngine(
> 64 |           new Worker(new URL("../worker/web-worker.ts", import.meta.url), {
     |              ^
  65 |             type: "module",
  66 |           }),
  67 |           engineConfig,
 ⨯ app\client\webllm.ts (64:14) @ Worker
 ⨯ uncaughtException: 

Steps to Reproduce

Just run npm run dev and load the first page. On console, you can see the message above.

Expected Behavior

I'm wondering if this is the root cause of failure in access from others in lan.

Screenshots

No response

LLM Model ID

No response

Desktop Browser

No response

Desktop Browser Version

No response

Smartphone OS

No response

Smartphone Browser

No response

Smartphone Browser Version

No response

Additional Logs

No response

DeepAlien890 avatar Jan 19 '25 15:01 DeepAlien890