Setting up fake worker failed
tatarrenat opened this issue · 5 comments
also having this issue
I have the same issue and found two workarounds, if you're depending elsewhere in your project to pdfjs-dist
you can change (inside your node_modules
folder):
svelte-pdf/src/lib/PdfViewer.svelte
Line 26 in 87116ac
pdf.worker.entry.js
, OR fork the project and update the pdfjs-dist
dependency to ^3.8.162
(latest version for me at the time of testing) and the error will go away.
Edit: Re-installing your dependencies and then restarting the dev server also fixes it sometimes, too random of a bug
just ran into the same issue, added the specified version to my package json and it would work !, thanks for the tipp
I found I was able to modify svelte-pdf/src/lib/PdfViewer.svelte with the following to get workers to work
- import * as pdfWorker from 'pdfjs-dist/build/pdf.worker.mjs'
+ import pdfWorker from 'pdfjs-dist/build/pdf.worker.mjs?worker&url'
As per
https://vitejs.dev/guide/features#web-workers
mozilla/pdf.js#8305
mozilla/pdf.js#17504
to:
pdf.worker.entry.js
got mine to work instead by changing it to pdf.worker.min.js