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
Almost 1MB in bundle file size? #48
Comments
Hey @zaynv! Deleted my previous response as it was totally wrong. Yes, you are right, I investigated and we can indeed make the bundle much smaller. Still it will be pretty large, several hundred K. Optimizations will come in the next release! |
Hi! Why the bundle was so big?A big mistake of mine was that pdf.worker.js was sneaking into the bundle - I've had the same situation with my react-pdf sample page. Why having pdf.worker.js in the bundle is considered a mistake?PDF.js is not designed to work with Webpack specifically and default Webpack's behavior to put it in the bundle is an unwanted behavior. More on this here. What has been done on react-pdf side to resolve this?I've fixed this on my current master branch and now I'm building the project in a way that copies pdf.worker.js file into my output directory while ignoring pdf.js's request to require it in its own bundle. If you want to test this bleeding edge code, temporairly change your package.json to say: What is the outcome?
What I could use a hand with?
|
Hey! |
Hey, sorry for my late response. But amazing work, thanks very much, I look forward to trying out the new version. You are awesome! |
Hey, and thanks for the amazing work on this project.
I had a question regarding the size of
react-pdf
. I created a small test-app withcreate-react-app
, and the only code I put in was the sample code you provided as an example (gist here). When I rannpm run build
to create a thecreate-react-app
version of a production bundle, thebundle.js
file size came out to be955K
.Is this to be expected when using this project? Is this project using minified versions of
pdfjs
? If not, is there a way I can make it do so for production?Thanks for your time, and great work on the project nnarhinen and all contributors!
The text was updated successfully, but these errors were encountered: