Open jamesmarchment opened 2 years ago
You are right, fetching the assets from root will cause an error when opening the playground from e.g. a file:///
path. When I test the playground locally I usually do the following:
cd playground/public
python3 -m http.server
Hi,
Apologies if this is just caused by my own error or unfamiliarity with npm, but when trying to recreate the Playground locally I ran into a bunch of problems... and then sorted them out by making a very small change to the code.
I kept getting 404s and failed fetch requests on "logo.pdf" and "opensans.ttf" until I opened playground.js and saw that on lines 100-103 the paths are absolute:
So I changed them to relative paths:
...and after repeating the npm build process it worked fine. I think this isn't a problem on http://pdfjs.rkusa.st/ because there it is in a root directory, but when running it in a folder it causes an error that stops the whole thing from working. Again, sorry if this is the kind of thing that doesn't present a problem for more experienced developers, but I in my noob-ness got really hung up on it for a while before I discovered the cause.