1
0
Fork 0
mirror of https://github.com/mozilla/pdf.js.git synced 2025-04-19 06:38:07 +02:00

[api-minor] Add the Babel targets-option to avoid transpiling code for unsupported browsers

Currently we simply use the Babel `preset-env` in the `legacy`-builds of the PDF.js library. This has the side-effect of transpiling the code for *very old* browsers/environments, including ones that we (since many years) no longer support which unnecessarily bloats the size of the `legacy`-builds.

For the CSS files we're only targeting *the supported browsers*, and it's thus possible to extend that to also apply to Babel.
One of the most significant changes, with this patch, is that we'll no longer polyfill `async`/`await` in the `legacy`-builds. However, this shouldn't be an issue given the browsers that we currently support in PDF.js; please refer to:
 - https://github.com/mozilla/pdf.js/wiki/Frequently-Asked-Questions#faq-support
 - https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function#browser_compatibility
This commit is contained in:
Jonas Jenwald 2022-08-19 10:45:40 +02:00
parent 8f74fe6e1b
commit 6e31799948
5 changed files with 18 additions and 81 deletions

View file

@ -24,7 +24,7 @@ Feel free to stop by our [Matrix room](https://chat.mozilla.org/#/room/#pdfjs:mo
### Online demo
Please note that the "Modern browsers" version assumes native support for
features such as `async`/`await`, optional chaining, nullish coalescing,
features such as optional chaining, nullish coalescing,
and private `class` fields/methods.
+ Modern browsers: https://mozilla.github.io/pdf.js/web/viewer.html