gspasov / svelte-pdf-simple

A simple svelte library for displaying pdfs that gives you full control
MIT License
53 stars 3 forks source link

Uncaught (in promise) SyntaxError: The requested module '/node_modules/pdfjs-dist/build/pdf.js?v=a9f48987' does not provide an export named 'GlobalWorkerOptions' #1

Closed dciug closed 2 years ago

dciug commented 2 years ago

I'm just trying out the example in the Readme.

gspasov commented 2 years ago

I created a brand new svelte project, installed the library and setup one of the examples. Everything seems to be working fine on my end, so I'm curious what is different for you in order to fail.

Could you provide me a little bit more details?

You could just as well give me a repo with the issue reproduced. And I could look into that as well.

PS. Although I saw that my first few examples don't have a closing tag.. Will be fixing that.

dciug commented 2 years ago

npm: v8.5.5 node: v17.9.0 svelte: v3.48.0 Running on svelte-kit@next with TypeScript. For now, i'm using the built-in browser PDF viewer, but i'll come back to this project to try it again.

gspasov commented 2 years ago

Thank you for the info, I'll try to reproduce the issue.

gspasov commented 2 years ago

I created a new svelte-kit project using npm init svelte@next and setup a Skeleton project with TypeScript. Set my node version to v17.9.0. My svelte and npm are the same version as yours.

I went to index.svelte and added the following code:

<script lang="ts">
  import { PdfViewer } from "svelte-pdf-simple";
  const pathToPdf = "./acord.pdf";
</script>

<PdfViewer url={pathToPdf} />

Inside the /static folder I added my acord.pdf PDF and the pdf is loaded normally with no errors in the terminal or browser console.

(I tested all my other examples as well and they work just fine)

I'm assuming that you are doing something different. If you could create a repository with the issue reproduced I'll be happy to look into it. Or guide me into what are you doing differently in order for me to catch the issue.

xellDart commented 2 years ago

Same error:

Node: 16.16.6 Sveltekit all dependencies to next in package.json Using node-adapter

gspasov commented 2 years ago

Are you getting this error with the example in the README or with something else?

gspasov commented 2 years ago

I'm going to close this issue since I'm unable to reproduce it. If someone could provide a repo with reproduction where I could look into it feel free to re-open the issue.