Can't get a webworker to run with react-pdf/renderer in ViteJS #3054
Unanswered
Celludriel
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey,
I'm trying to create a blob from a react-pdf/renderer element in a webworker. I'm using ViteJs for this and I'm at a loss how I should proceed.
webworker
test-document
useEffect of my calling environment
The error I'm getting
@react-refresh:672 Uncaught ReferenceError: window is not defined
at @react-refresh:672:1
I have tried serveral things to get past this, including trying to seriliaze testDocument() and sent it as a string to the webworker and deserialize it there but that was more of a hail mary that didn't pan out at all , cause I was loosing information during the procedure. Is there anything you can help me with to get this working ?
If I start commenting out my code in the webworker I eventually can deduce that this line:
const myPdf = pdf(testDocument())
is the culprit for starting to throw the error
Beta Was this translation helpful? Give feedback.
All reactions