Description
Hi, I did set up react-pdf and it works perfectly, I did followed the instructions. But in development once I open a page that render a pdf file i get an error 404. Saying that a request for a path "/pdf.worker.js" has been done ( not by me volontary) and an error 404 is returned.
Anyone knows why this error and how to fix it? thanks
I built the app using create-react-app, react router and express.js
Steps to reproduce
Steps to reproduce the behavior:
You can see it live here: http://www.lostudenteim.it/materie-infermieristica/file-fisiologia-umana
Environment
Seeing that pdf.worker.js
request is done suggests me you're using default entry file (import ... from 'react-pdf'). That means you need to take care of copying pdf.worker.js
by yourself. You have more options available - automatic config for Webpack and Parcel.
@wojtekmaj Yes you are right I am importing manually.
IF I want to do it by my self:
1) Where should I copy it?
2) What should in it?
3) What is it for?
ad 3. https://github.com/wojtekmaj/react-pdf#enable-pdfjs-worker
ad 1 & 2. https://github.com/wojtekmaj/react-pdf#browserify-and-others
thanks, sorted :)
Most helpful comment
Seeing that
pdf.worker.js
request is done suggests me you're using default entry file (import ... from 'react-pdf'). That means you need to take care of copyingpdf.worker.js
by yourself. You have more options available - automatic config for Webpack and Parcel.