N
Nuxt3mo ago
kogratte

Load worker

Hey there! I'm trying to use a worker I need to load this way: new Worker(MyWorkerSrc?param1=x&param2=y), x and y being defined dynamically. Then, the worker should use url search params to instantiate what needs to be. My worker currently leaves in @/assets/worker/myWorker.ts. How can I make sure that: - Worker is being compiled - Worker is available in output - Worker will be loaded using the new Worker() call ?
2 Replies
kapa.ai
kapa.ai3mo ago
Hi @kogratte. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I'm sorry, but the knowledge sources provided do not contain explicit information about compiling, outputting, or loading web workers (such as TypeScript workers in assets) in a Nuxt 3 project, nor about handling dynamic query parameters in worker URLs. There is a mention of a Nuxt PR that allows loading virtual files with query params (notably for virtual CSS files), but it does not cover the use of web workers or their compilation/output process in Nuxt projects, nor does it provide guidance on how to ensure a worker in the assets directory is compiled and available for use with new Worker() calls with dynamic parameters fix(nuxt): allow loading virtual files with query params. If you need detailed guidance on this topic, you may need to consult the Nuxt documentation or open an issue on the Nuxt GitHub repository for more targeted support. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai3mo ago
<@639111892144619539> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?