Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<hash>.worker.js returns Error 404 #386

Closed
3 tasks done
aleyan opened this issue Apr 17, 2019 · 2 comments
Closed
3 tasks done

<hash>.worker.js returns Error 404 #386

aleyan opened this issue Apr 17, 2019 · 2 comments
Labels
duplicate This issue or pull request already exists question Further information is requested

Comments

@aleyan
Copy link

aleyan commented Apr 17, 2019

Before you start - checklist

  • I have read documentation in README
  • I have checked sample and test suites to see real life basic implementation
  • I have checked if this question is not already asked (already asked, but not exactly like mine )

What are you trying to achieve? Please describe.

Trying to use react-pdf with importing via
import { Document, Page } from 'react-pdf/dist/entry.webpack';
Get an error
GET http://localhost:9000/rewritten/deep/route/91d10c18b9b34c233fe3.worker.js 404 (not found)
when the react-router set url is at http://localhost:9000/rewritten/deep/route/
The 91d10c18b9b34c233fe3.worker.js is available at http://localhost:9000/static/myapp/91d10c18b9b34c233fe3.worker.js
/static/myapp/vendors~pdfjsWorker.main.js also exists. The react app itself is at /static/myapp/main.js.

Describe solutions you've tried

I have tried setting:

pdfjs.GlobalWorkerOptions.workerSrc = '/static/myapp/vendors~pdfjsWorker.main.js';
``` which results in one successful load followed by 404 when trying to get `http://localhost:9000/rewritten/deep/route/vendors~pdfjsWorker.main.js`

**Additional information**

```import { pdfjs } from 'react-pdf';
pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`; ```
Works for me, but I want to not rely on the one on the cdn if possible.

**Environment**

 - Browser (if applicable) Chrome 73:
 - React-PDF version  4.0.5:
 - React version 16.5.2:
 - Webpack version 4.4.19:
 - React Router 5.0.0
@wojtekmaj
Copy link
Owner

Duplicate of #97

@wojtekmaj wojtekmaj marked this as a duplicate of #97 Apr 24, 2019
@wojtekmaj
Copy link
Owner

Please keep discussions going in #97 instead.

@wojtekmaj wojtekmaj added duplicate This issue or pull request already exists question Further information is requested labels Apr 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants