shkreios / vite-react-pdf-renderer-web-worker

Created with StackBlitz ⚡️
https://stackblitz.com/edit/vite-react-ts-zbwjtr
8 stars 2 forks source link

NextJS web worker? #1

Closed dimasandriano closed 2 weeks ago

dimasandriano commented 1 month ago

can i use web worker in nextjs for render pdf with react pdf renderer? I have tried something like this repository but it failed because it uses nextjs.

shkreios commented 4 weeks ago

@dimasandriano i am using this in a similar way with nextjs on another project. What is bug you are running into?

dimasandriano commented 3 weeks ago

@shkreios I don't know, maybe I'm not smart enough to try it in nextjs. can i ask for an example of its use in nextjs please?

shkreios commented 3 weeks ago

@dimasandriano here you go https://stackblitz.com/github/shkreios/nextjs-pdf-renderer-web-worker, keep in mind this may not be the best way to do this for your usecase.

The code is mostly identical, the only thing that was vite specific is the import a worker using query-suffix like so import Worker from './workers/pdf.worker?worker'

dimasandriano commented 1 week ago

thank u sir