-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Use of eval in "node_modules/pdfjs-dist/build/pdf.js" is strongly discouraged as it poses security risks and may cause issues with minification #16061
Comments
Please note that "Vite" isn't something we use here, and thus we unfortunately can't really provide help/support for it. Furthermore, note that the code in question is intended specifically for Node.js environments; please see the following comment for additional context here: Lines 2296 to 2317 in 546902d
|
That's ok thanks for providing me a link to the source. I'll check with the vite team to see if there's a way to remove this error. |
Hey. We have the same issue with the Rollup bundler. Rollup complains about the use of eval when bundling: https://rollupjs.org/troubleshooting/#avoiding-eval Is there something that can be done to remove eval in pdfjs? |
Maybe, but that could very easily end up breaking more things than it fixes unfortunately. If you look at the code/comment linked in #16061 (comment) you'll see that this was done for improved Webpack compatibility (for a while there were loads of issues filed about that). Hence trying to fix this issue could thus risk:
Given that this doesn't affect the built-in Firefox PDF Viewer, I cannot really justify spending my spare time trying to fix this (since I'm not getting paid to hack on the PDF.js library). |
Ok, I understand. Thank you for taking your time and for the work you are putting into this, it's appreciated. |
It looks like this could be a way to suppress these warnings: |
Configuration:
Repo:
Steps to reproduce the problem (with repo):
git clone git@github.com:gkiely/pdfjs-issue.git
cd pdfjs-issue
npm i
npm run build
Steps to reproduce the problem (without repo):
npm create vite@latest
pdfjs-issue
Vanilla
JavaScript
cd pdfjs-issue
npm i pdfjs-dist
import pdfjs from 'pdfjs-dist';
npm run build
What is the expected behavior? (add screenshot)
The text was updated successfully, but these errors were encountered: