-
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
publish es6 modules to npm #10317
Comments
In an ideal world, If there's interest, I'd be happy to provide a PR. |
As an interim workaround, we've published this: https://github.com/bundled-es-modules/pdfjs-dist |
Is this the bundled-es-modules/pdfjs-dist repo still relevant or has module functionality been rolled into this main distribution? There seem to be “components” in this repo. |
the published
or is there another distribution somewhere? |
@timvandermeij any update on this?
|
That would be very helpful. |
Hi! Commenting to give this a bump. I would love this to be tree-shakeable since I do not actually need |
This comment has been minimized.
This comment has been minimized.
This is a big issue as the JS package ecosystem migrates from CommonJS to ESM. The migration has progressed a lot since this issue was opened in 2018, and ESM is now very much standard, and nowhere near bleeding-edge (especially on frontend, as opposed to on nodejs which is another story). Webpack can still handle this, but next-gen bundlers like Vite cannot. @Snuffleupagus Any plan to publish ES Modules to catch up with the ecosystem? |
https://github.com/mozilla/pdf.js/blob/master/src/pdf.js => ES modules This project is developed with ES modules, but the Seems like this would be an easy fix, no? |
Please keep in mind that the primary focus of development for this library is the Firefox PDF Viewer. For the general PDF.js library, we've been doing various work (over the years) to clean-up and simplify things in order to reduce the number of builds that we have to maintain/support. Hence why we provide both browser and Node.js support in the same builds in e.g.
And neither should it be, since the only thing that we officially support is the functionality accessed via https://github.com/mozilla/pdf.js/blob/master/src/pdf.js respectively https://github.com/mozilla/pdf.js/blob/master/web/pdf_viewer.component.js (once those files are built and and published in Please keep in mind that using the "raw"
Not really, since as mentioned above we don't want to add even more builds and we also want to support both browsers and Node.js environments with the same builds. |
Node package exports would allow you to publish plain, unbundled modules but only allow importing specific entry points. Node has also supported modules for the last 7 major and 4 LTS versions, so you could still keep one build for both (modulo using environment specific API like DOM and process.env). |
This would be a great addition to have in 2023 |
I was looking to use pdf.js today via something like
import {pdfjs} from pdfjs-dist/pdf.js
and learned that all that is available is a require module.Would it be possible to add es6 modules somewhere on npm?
The text was updated successfully, but these errors were encountered: