Thank you @stray lintel , but I am not streaming data nor passing any states. Mainly, I am just letting the worker to create a Threejs scene and prase it as JSON and return it. My worker is kinda looking like this:
// Webworker that doesn't use any of the component's state!
const myWorker$ = Worker$(() =>{
const scene = new THREE.Scene();
// Do some object loading magic...
//...
return {scene: pare(scene)}
})
useVisibleTask$(() => {
myWorker$().then(({scene}) => {
// change scene to object instead of string
// Save the Scene in a signal or a store...
})
})
I tried to replicate the code structure and logic from my memory because I scrapped the idea of web workers since it had problems. The issue was as I recall: You can't use a "use*" function in this scope. It manipulates the hierarchy. I think the main issue was that Qwik Webworkers package must be called from a JSX code only. But I am surprised why it worked in development server but not in production
Sorry for the limited information.