Replies: 3 comments 1 reply
-
faced the same problem |
Beta Was this translation helpful? Give feedback.
0 replies
-
@mihaon did you find a solution? |
Beta Was this translation helpful? Give feedback.
1 reply
-
Hi, currently I crafted a hello world example for https://github.com/TaQuanMinhLong/nuxt-worker-threads-example You can define workers in server/workers, init workers in a server plugin |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I have a dynamic server-side PDF generator in the nuxt application. But since PDF generation blocks event loop I need to put it in the separate worker thread (
node:worker_threads
).So I create the
server/routes/offers-pdf.get.js
route and theworkers/pdf.js
worker. But when I build nuxt app, theworkers/pdf.js
is missing from the.output
directory. So I need to manually deploy it to the production server (also with anode_modules
directory). Imports from paths like~/utils/someFunction.js
insideworkers/pdf.js
doesn't work too.Is there a solution to preserve the worker in the .output directory? Maybe I should import it in the
offers-pdf.get.js
route likeimport worker from ~/workers/pdf.js?worker
or something similar?Example
server/routes/offers-pdf.get.js
workers/pdf.js
package.json
Beta Was this translation helpful? Give feedback.
All reactions