developit / web-worker

Consistent Web Workers in browser and Node.

Home Page:https://npm.im/web-worker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failing to compile web-worker during vite build

projjal1 opened this issue · comments

During compilation with vite build, the compiler is giving error message as cannot destructure property mod from threads.workerData as it's undefined.

Had the same issue, I think in line 130 in node.js we need to check if threads.workerData is undefined, or set it as an empty object. This should fix it:

  let {
    mod,
    name,
    type
  } = threads.workerData || {};

UPDATE: Looks like the author already had a fix for the root cause here: #40