Pdf.js: publish es6 modules to npm

Created on 29 Nov 2018  ·  5Comments  ·  Source: mozilla/pdf.js

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?

1-other

Most helpful comment

All 5 comments

In an ideal world, src should be refactored as standard modules. If CJS is still needed, it could be automatically built (say, in a cjs directory) using rollup or other similar tools, or better yet - left up to the user to generate (node users could easily use the esm module to enable es module syntax in node apps). That would allow library users to choose if, when, and how to bundle or transpile.

If there's interest, I'd be happy to provide a PR.

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 pdfjs-dist still seems to not have es modules?

or is there another distribution somewhere?

@timvandermeij any update on this?

node_modules/ng2-pdf-viewer/__ivy_ngcc__/fesm2015/ng2-pdf-viewer.js depends on 'pdfjs-dist/build/pdf'. CommonJS or AMD dependencies can cause optimization bailouts.
Was this page helpful?
0 / 5 - 0 ratings

Related issues

patelsumit5192 picture patelsumit5192  ·  3Comments

PeterNerlich picture PeterNerlich  ·  3Comments

SehyunPark picture SehyunPark  ·  3Comments

aaronshaf picture aaronshaf  ·  3Comments

jigskpatel picture jigskpatel  ·  3Comments