question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Please help me testing React-PDF 5.0 beta update!

See original GitHub issue

Hi, React-PDF v5.0.0-beta.5 has been released introducing a few major updates:

  • React-PDF now ships with ES6 Modules
  • Updated pdf.js from 2.1.266 to 2.4.456.

Breaking changes:

  • You will need to change your imports to bundler-specific entry files, for example instead of:
    import { Document } from 'react-pdf/dist/entry.webpack';
    
    you’ll now write:
    import { Document } from 'react-pdf/dist/esm/entry.webpack';
    
  • Dropped support for IE 11 due to pdf.js dropping support

so upgrade should be a piece of cake.

Please share your experiences - whether it works correctly in your project, doesn’t break the build, and so on.

Thanks!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:41 (21 by maintainers)

github_iconTop GitHub Comments

11reactions
pohlmancommented, Jul 21, 2020

Just an FYI that the latest breaks IE11 due to pdf.js deciding to remove support for it (annoyingly in a minor version).

The pdfjs-dist/es5 imports you switched to are fine, but things imported from pdfjs-dist/lib like PDFLinkService aren’t transpiled, and still have classes in the final output. It took a while to figure out what was going on, and we solved it by configuring babel to that transpile imports from that module.

The CDN link for pdf.worker.js is also no longer transpiled, so we switched to pdfjs.GlobalWorkerOptions.workerSrc = `//unpkg.com/pdfjs-dist@${pdfjs.version}/es5/build/pdf.worker.js`;

10reactions
samalexandercommented, Jun 10, 2020

With v5.0.0-beta.4 I am seeing the following error in the console. Anyone else experiencing the same?

image

Read more comments on GitHub >

github_iconTop Results From Across the Web

Keywords - react-pdf - npm
Start using react-pdf in your project by running `npm i react-pdf`. ... react-pdf. 5.1.0-beta • Public • Published 2 years ago.
Read more >
Displaying PDF in React app - Level Up Coding
I want to show you an easy and simple way to display PDF files using React in the browser. I will be using...
Read more >
Enzyme is dead. Now what? - DEV Community ‍ ‍
Enzyme, a popular utility to test React components, is dead. It's time to move on. Here's why I think so. For a long...
Read more >
Thinking in React
React is, in our opinion, the premier way to build big, fast Web apps with JavaScript. It has scaled very well for us...
Read more >
Could not resolve dependency error peer react@"^16.8.0
Instead of npm install, please use npm install --legacy-peer-deps. ... tend to give you better error messages which has helped me in the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found