React-pdf: <hash>.worker.js returns Error 404

Created on 20 Jul 2018  ·  4Comments  ·  Source: wojtekmaj/react-pdf

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.

pdf.worker.js error

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

  • Browser: Chrome version [67.0.3396.99]
  • React-PDF version [e.g 3.0.5]:
    "react": "^16.3.2",
    "express": "^4.16.3",
question

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 copying pdf.worker.js by yourself. You have more options available - automatic config for Webpack and Parcel.

All 4 comments

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?

thanks, sorted :)

Was this page helpful?
0 / 5 - 0 ratings