josdejong/workerpool

DomException when passing parameters to worker (Vue3, webpack5)

Corey-J opened this issue · 4 comments

Hi, I'm just setting up a worker in Vue to offload some calculations to and upon setting up data i am struggling to pass parameters into the exec method.

I have verified workers are running on methods not being passed parameters, but the below errors occurs when calling exec with any parameters.

Any help would be appreciated!

Worker.ts Definition
image

Calling Worker
image

Exception
image

edit:
When using the proxy example and calling the method this is successful
image

How can we reproduce your issue? Can you create a minimal demo on https://stackblitz.com/ for example?

This will take some time to transpose the setup of the project, and may not be possible in a cloud sandbox - but i shall see what can be done.
The project uses Razor to render a Vue 3 application compiled via webpack with quite a fair bit of config

Using a standard web worker.postMessage being able to send the same object is functional.

@Provide()
worker!: Worker

.....

const WorkerURL = new WorkerUrl(new URL('../worker.ts', import.meta.url));
this.worker = new Worker(WorkerURL.toString());

let sendObject = { complexObj1: complexObj1, complexObj2: complexObj1};

this.worker.postMessage(JSON.stringify(sendObject));

Thanks. Maybe it helps to copy your existing project and strip it down to the core to figure out what part is relevant for the issue.

Closing due to a lack of response. Please reopen if still relevant.