I have a project that is using the mpg123-decoder package (tried both 0.4.9 and 0.4.10), which seems to rely on @eshaz+web-worker@1.2.1 as a dependency, and the type error is causing my project builds to fail:
node:internal/event_target:1010
process.nextTick(() => { throw err; });
^
TypeError [Error]: Cannot destructure property 'mod' of 'threads.workerData' as it is undefined.
at workerThread (/Users/mathew/Dev/talewind-app/node_modules/.pnpm/@eshaz+web-worker@1.2.1/node_modules/@eshaz/web-worker/cjs/node.js:131:5)
at Object.<anonymous> (/Users/mathew/Dev/talewind-app/node_modules/.pnpm/@eshaz+web-worker@1.2.1/node_modules/@eshaz/web-worker/cjs/node.js:67:56)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:169:29)
at ModuleJob.run (node:internal/modules/esm/module_job:194:25)
Emitted 'error' event on Worker instance at:
at [kOnErrorMessage] (node:internal/worker:290:10)
at [kOnMessage] (node:internal/worker:301:37)
at MessagePort.<anonymous> (node:internal/worker:202:57)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:735:20)
at exports.emitMessage (node:internal/per_context/messageport:23:28)
Seems like the root cause is in @eshaz+web-worker@1.2.1/node_modules/@eshaz/web-worker/cjs/node.js:131:5:
function workerThread() {
let {
mod,
name,
type
} = threads.workerData;
if (!mod) return mainThread();
Seems like this should fix it:
let {
mod,
name,
type
} = threads.workerData || {};
Would you be able to push a fix for the destructuring? Thank you.
Hi @eshaz,
I have a project that is using the
mpg123-decoder
package (tried both 0.4.9 and 0.4.10), which seems to rely on@eshaz+web-worker@1.2.1
as a dependency, and the type error is causing my project builds to fail:Seems like the root cause is in @eshaz+web-worker@1.2.1/node_modules/@eshaz/web-worker/cjs/node.js:131:5:
Seems like this should fix it:
Would you be able to push a fix for the destructuring? Thank you.