Skip to content
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

pdfjs-dist doesn't have core-js in dependencies #11539

Closed
AndreyChernykh opened this issue Jan 27, 2020 · 3 comments · Fixed by #11542
Closed

pdfjs-dist doesn't have core-js in dependencies #11539

AndreyChernykh opened this issue Jan 27, 2020 · 3 comments · Fixed by #11542
Labels

Comments

@AndreyChernykh
Copy link

AndreyChernykh commented Jan 27, 2020

Attach (recommended) or Link to PDF file here: N/A

Configuration:

  • Web browser and its version: N/A
  • Operating system and its version: Mac OS
  • PDF.js version: Any
  • Is a browser extension: No

Steps to reproduce the problem:

  1. N/A

What is the expected behavior? (add screenshot)

pdfjs-dist should have all required 3rd-party packages (including core-js) explicitly specified in the package.json dependencies.

What went wrong? (add screenshot)

If in the app a version of core-js mismatch the implicit expectation of the pdfjs-dist code in pdfjs-dist/lib/shared/compatibility.js, then it leads to unexpected behaviour or build errors, such as

Module not found: Error: Can't resolve 'core-js/es/string/starts-with'

Link to a viewer (if hosted on a site other than mozilla.github.io/pdf.js or as Firefox/Chrome extension):
N/A

See similar issue parcel-bundler/parcel#2819 (comment)

@AndreyChernykh
Copy link
Author

AndreyChernykh commented Jan 28, 2020

@Snuffleupagus Hi

Sorry, I don't fully understand how is the linked PR related to the bug?

There are explicit core-js usages in pdfjs-dist
https://github.com/mozilla/pdfjs-dist/search?q=core-js&unscoped_q=core-js

And no explicit dependency from core-js, which means, that pdfjs-dist will use whatever version of core-js is happen to be used in the app.

@timvandermeij
Copy link
Contributor

The pull request is making it more clear that the /lib folder shouldn't be used for anything other than unit tests. For using PDF.js you should use the pre-built versions because core-js is a dev dependency and its references will be resolved on build time. Hence there should be no need to put core-js in the dependencies of pdfjs-dist.

@AndreyChernykh
Copy link
Author

@timvandermeij Got it! Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants