Closed lilcorey closed 4 years ago
Is this still being worked on or no? @wojtekmaj
Any updates?
@bugzpodder Unfortunately pdfjs-dist 2.4.456 is a pre-release and we won't be updating to unstable dependency. I'm looking forward to Mozilla releasing a stable version, hopefully soon.
@wojtekmaj How would you feel about pushing a new beta release with the new pdfjs-dist version so that we can do some testing on our end? i.e. v5.0.0-beta.3
?
Sure thing, can be done - 5.0 will be out soon so we could advance the beta channel :)
I tried installing 5.0, still getting warnings.
I tried installing 5.0, still getting warnings.
I'm pretty sure nothing has changed quite yet; if I'm interpreting what @wojtekmaj said earlier correctly, my guess is he'll release version 5.0 – which will ship with pdf.js 2.3.200
– as stable, and then create a new beta version – like 5.1.0-beta.1
– which will ship with pdf.js 2.4.456
(per #550).
I'm using the following postinstall
script to handle this issue:
#!/usr/bin/env bash
# https://github.com/wojtekmaj/react-pdf/issues/280
set -eu
NL=$(grep -n 'var useRequireEnsure = false' ./node_modules/pdfjs-dist/build/pdf.js | awk -F: '{print $1}')
START=$((NL - 1))
END=$((START + 51))
sed -i.bak -e $START's/{/\/*{/' ./node_modules/pdfjs-dist/build/pdf.js
sed -i.bak -e $END's/}/}*\//' ./node_modules/pdfjs-dist/build/pdf.js
Hey guys, any updates on this problem? I managed to use the library following the tip from @mikemclin:
import {pdfjs, Document, Page} from 'react-pdf';
pdfjs.GlobalWorkerOptions.workerSrc = `//cdnjs.cloudflare.com/ajax/libs/pdf.js/${pdfjs.version}/pdf.worker.js`;
But I still get the warning:
./node_modules/pdfjs-dist/build/pdf.js
Critical dependency: require function is used in a way in which dependencies cannot be statically extracted
Any current solution without using react-app-rewired?
Hey @wojtekmaj . v2.4.456 is LTS now https://github.com/mozilla/pdf.js/releases/. Can we look into merging this PR https://github.com/wojtekmaj/react-pdf/pull/550 ?
Pinging this in hopes that this issue might be fixed soon? Any updates? @wojtekmaj
React-PDF 5.0.0-beta.4 is out with pdf.js 2.4.456 under the hood. Feedback from those previously affected by this bug is welcome :)
I can confirm, with 5.0.0-beta.4 the error message is gone for me
error is gone with 5-beta.4
No errors in 5.0.0-beta.4. Waiting for the stable version.
I'm facing same problem: my dependencies are:
"dependencies": {
"@fortawesome/fontawesome-svg-core": "^1.2.28",
"@fortawesome/free-solid-svg-icons": "^5.13.0",
"@fortawesome/react-fontawesome": "^0.1.10",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"axios": "^0.19.2",
"bootstrap": "^4.5.0",
"bootswatch": "^4.5.0",
"jsonwebtoken": "^8.5.1",
"react": "^16.13.1",
"react-bootstrap": "^1.0.1",
"react-dom": "^16.13.1",
"react-password-strength": "^2.4.0",
"react-pdf": "^5.0.0-beta.4",
"react-redux": "^7.2.0",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.1",
"react-toastify": "^6.0.5",
"redux": "^4.0.5"
},
I would thanks any help Best regards
@PedroRuiz just to confirm, you deleted the npm_modules folder? Before install again the packages?
@wojtekmaj Hm. 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.
Please mind that this thread is for this specific error only. Please use #495 for general 5.0 beta discussion.
@GabrielF9 I did it.
@PedroRuiz Oh, I maked this and got all works fine. Can you share the part of code where you use the react-pdf?
@GabrielF9 I don't know why, it goes fine now. I apologize for inconvenience
@PedroRuiz happens hahahaha happy it worked
React-PDF 5.0.0-beta.4 is out with pdf.js 2.4.456 under the hood. Feedback from those previously affected by this bug is welcome :)
@wojtekmaj This fix works like a charm! Any insight on when it'll be in a stable version?
If not for the performance degradation it'd be already live. I don't think there will be any developer facing changes at this point though.
Yes!!!, after upgrading to React-PDF 5.0.0-beta.4, the warning is gone!
It there any chance to resolve this error at 4.x version? I cannot use 5.x because of compatibility with IE11 :-/
There's no way. The first version pdfjs shipped with this issue was actually the one that already dropped IE11 support, which we noticed later.
I havent got any solution myself too & still stuck on the same prob.
As I said there's absolutely no way 4.x will have this issue fixed. Either upgrade to 5.x or live with it. Sorry.
Bumped to 5.2.0 and still seeing this error message.
The irony here is that I don't even need this package. I don't display PDFs. The "standard" instructions don't work for me because I don't call on this package ever. It became a complete block when I moved to TS v4 coupled with another dependency upgrade I was testing out.
UPDATE: As advised, I fixed my TS config. If anyone is still getting these messages on Webpack 4, go back and walk through all your types and configuration. I added back a huge list of packages and it magically fixed itself.
"@babel/plugin-transform-runtime": "^7.13.8", <- installed it new
"@babel/runtime": "^7.13.8", <- installed it new
"@babel/runtime-corejs3": "^7.13.8", <- installed it new
"react-app-rewired": "^2.1.8", <- installed it new
"@babel/polyfill": "^7.12.1", <- installed it new
"@babel/preset-typescript": "^7.13.0", <- installed it new
"@types/jest": "^26.0.20", <- upgraded it
"@types/node": "^14.14.31", <- upgraded it
"@types/react": "^17.0.2", <- upgraded it
"@types/react-dom": "^17.0.1", <- upgraded it
"babel-loader": "^8.2.2", <- upgraded it
"ts-import-plugin": "^1.6.7", <- installed it new
"typescript": "4.2.2", <- upgraded it
Updating create-react-app to v2.0.3 has resulted in this node module to not load PDFs.
Describe solutions you've tried
Deleting the module and reinstalling via npm install has resulted in the same issue.
Additional information
If applicable, add screenshots (preferably with browser console open) and files you have an issue with to help explain your problem.
Environment