-
-
Notifications
You must be signed in to change notification settings - Fork 901
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
Please help me testing React-PDF 5.0 beta update! #495
Comments
Hello, i have updated from version 4.1.0 to this one and changed the imports. I could not detect any problems while building or executing. |
Hi I just tested the new version: In a testing (production build) environment, the following is logged to the console of Chromium: The This is a SPA so the MIME type error is due to the frontend 404 page being returned from an invalid route. I imagine this is probably a Webpack configuration issue. I am importing the It doesn't happen with Webpack config: My Webpack config is a bit long/complicated so I'll see if I can isolate this to a particular set of config options. |
I boiled this down to the Webpack config option: With optimization: {
sideEffects: false,
} This got the production build to work without falling back to the "fake worker" at runtime. I imagine this is related to: Line 8 in adb00b8
|
Removing the line Line 8 in adb00b8
Worked for me without having to include:
in my Webpack config with Sorry for sort of hijacking this thread. I'll create a pull request shortly. |
I've tested 5.0.0-beta.2 both in development mode and a build that I ran locally. I didn't see any errors on the screen or in the console. I tested a wide variety of documents. It'd be nice to get the Worker Blob fix #452 in. |
I have tried running it with typescript but to no avail. Is there an up to date version of the @types/react-pdf that's compatible with the beta ? I was hoping the beta might fix the #280 dependancy issue. I have used the cdn workaround and got react-pdf to work but would like to get rid of the error message. |
There are no substantial differences between 4.x and 5.x API, so types for 4.x should work 🤔 |
Weird. Maybe I did something wrong. import { Document } from 'react-pdf/dist/esm/entry.webpack'; I used these lines to import the files and I get "Could not find a declaration file for module 'react-pdf/dist/esm/entry.webpack'." |
I'm considering using this in Polar (https://getpolarized.io/) as I need to rework our PDF viewer to be a bit more modern, support mobile + tablets, etc. For us this would be a major component and I need it to be really solid. There are a few things that are missing with react-pdf ... which you seem to have done a great job with btw!
I figure if the Typescript change is too much for you I can just work on the PDFFindController and latest PDF.js migration and then maybe you could cherrypick those and we would just maintain a fork for a bit. Thoughts? |
@vincentdegheyndt That would be @DefinitelyTyped typings issue. |
I experimented with that in the past a little, but didn't find a good way to implement it as understandable React-based API. It's a pain - I'd love to see some concepts around this.
Since majority of our contributors, including the main one being me, are not very familiar with TypeScript, I see this as a thing that could potentially slow us down by a large chunk. We would need someone with this knowledge available as a fully fledged team member.
Mozilla doesn't have very good history with keeping their version numbers in line with semver guidelines, and that's why it's set to exact match in our dependencies. Still, more often than not, you can go ahead and try newer PDF.js version on your own (using yarn resolutions for example) without any major issues. |
FYI: next beta, v5.0.0-beta.3 is out :) |
Updated to
Importing like No other issues. The newer version of PDF.js fixed a rendering issue in some of our pdfs, so this update has been very welcome. Thank you! |
Updated to |
Updated to 5.0.0-beta.3 Uncaught TypeError: Cannot read property 'destroy' of undefined 457: this.loadingTask.destroy(); may be we need to null check loadingTask |
React-PDF 5.0.0-beta.4 is out. Hopefully a final one (although Webpack's 18th beta is making me feel a little better 😅) pdf.js 2.4.456 is under the hood, although an ES5 build as I saw multiple compatibility issues with the new build, and I didn't want to introduce additional breaking changes between beta releases. |
Same - posting the error text for searchability:
A couple notes:
|
I tried the following using yarn resolutions to try to use pdfjs-dist 2.5.207, but
|
Hi @wojtekmaj, Is npm updated too ? I've run npm update react-pdf and nothing happen. |
Looks like the |
Here's PR with a fix! #590 |
Yes it is, but beta != latest. You will need to manually opt in to beta. npm update won't work for versions not marked as stable. |
You rock, thanks for fast answer. |
@wojtekmaj At version
I import components like this
|
That's odd - the way we load worker through Webpack loaders is unchanged and |
@wojtekmaj I get massive performance degradation and some odd behavior when upgrading from 5.0.0-beta.2 to 5.0.0-beta.4. We use the "standard" instructions to serve the pdf.js worker locally. |
@SamuelMS Any specific case? Would love to look into that if you have a minimal reproduction repo + PDF sample. |
Ouch. Yeah, this is buried pretty deep into proprietary code – with infinite loading and coupled to a few other libraries. Still, the only piece that changed here is the Totally understand you need more to go on here... I can try getting an example together, but it'll take me some time. |
@SamuelMS Perhaps you could share Chrome DevTools measurements then? They could make it easier to spot where the slowdown happens. Once recorded, you can use ⬇️ button to save the measurements. |
@negarineh That should be resolved with #593, which will be out in the next release. Hopefully stable one... 🤐 |
Same error with @negarineh when is the next release @wojtekmaj? :) |
Just an FYI that the latest breaks IE11 due to pdf.js deciding to remove support for it (annoyingly in a minor version). The The CDN link for pdf.worker.js is also no longer transpiled, so we switched to |
Uh, oh. Unfortunately this means that we will probably need to drop IE11 support too for the final 5.0 release in order to do any progress and allow future updates. The good news is that if that's the case, we will cherry-pick multiple fixes and improvements from 5.0 to 4.x branch. |
getGlobalEventBus is deprecated, use a manually created EventBus instance instead |
5.0.0-beta.5 has been released:
React-PDF home page already uses it 👀 Also, 4.2.0 has been released with long awaited fixes and improvements introduced during 5.0 development. |
Hi @wojtekmaj, I already see that #415 has been addressed in the |
@balrampariyarath Unfortunately not. #280/#415 has been addressed not in React-PDF per se, but in one of pdf.js updates, which also introduced a breaking change (dropping IE 11 support). As such, 4.x branch is stuck on this pdf.js version forever. |
Well, almost a year in beta, that was long enough in testing. v5.0.0 is out. React-PDF home page already uses it. Thanks everyone for sharing your comments and helping to push this release out. |
@wojtekmaj Apologies for the delay here – finally got around to this. Opened a new issue (#663) to make it easier to track. |
Hi,
React-PDF v5.0.0-beta.5 has been released introducing a few major updates:
Breaking changes:
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!
The text was updated successfully, but these errors were encountered: