Okay so i have an astro site and I just added svelte (typescript), when importing svelte-pdf as per the docs I get the following error when running yarn dev:
Error could not read from file: C:\...\node_modules\svelte-pdf\node_modules\pdfjs-dist\build\pdf.worker.js
The reason really is because pdfjs uses .mjs now and no default export, so changing it to the bottom phrase works:
pdfjs.GlobalWorkerOptions.workerSrc = new URL("pdfjs-dist/build/pdf.worker.js", import.meta.url);
In case anyone has this issue, make sure to set your svelte component in astro as follows:
Okay so i have an astro site and I just added svelte (typescript), when importing svelte-pdf as per the docs I get the following error when running
yarn dev
:The reason really is because pdfjs uses
.mjs
now and no default export, so changing it to the bottom phrase works:In case anyone has this issue, make sure to set your svelte component in astro as follows: