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

Request: tree-shakeable ES6 distributable modules #547

Closed
axefrog opened this issue Apr 24, 2017 · 3 comments
Closed

Request: tree-shakeable ES6 distributable modules #547

axefrog opened this issue Apr 24, 2017 · 3 comments
Milestone

Comments

@axefrog
Copy link

axefrog commented Apr 24, 2017

Any chance you guys could provide a tree-shakeable ES6 build in the dist folder? In other words, I already have a build system, as do many others who use Webpack 2 or Rollup. By transpiling to ES5, you're supporting people with older setups, which is great, but the rest of us have to suffer the huge build size unnecessarily. Even people using older setups are still often going to be doing their own transpiling, which means there's no need for you to do that for those people either.

The code already uses ES6, so it'd be great if you could simply build a non-transpiled version out to the dist folder as well, and provide an esnext module entrypoint in the package.json file. By doing so, users can import just the parts they need, and the rest can then be discarded during build, resulting in a much smaller bundle size.

@ellis2323
Copy link

I'm using the verify part of your PGP product and i would love to reduce the 350ko needed.

@bartbutler
Copy link
Member

The main issue with this is the web worker. In fact, if you are importing into your project using web pack you are probably inflating the size of your project also because you are duplicating openpgp.js in your bundle as well as having your clients separately download it for the web worker.

We haven't really found a great way to fix this. There might be one with clever use of blob URLs but it's kind of a mess and involves running eval on a huge string, which messes up debugging badly. That's why the recommended solution is the current one--keep openpgpjs outside your bundle as an external dependency, the browser then downloads openpgp.min.js once, and both the main context and the worker context use the same file.

And yeah, running without the web worker is a recipe for warnings about scripts taking a long time, so that's not really an option either. We are trying to do some pruning and updating so we can streamline the size of the package but I doubt it will ever be considered small.

@twiss twiss added this to the v5 milestone Sep 10, 2019
@twiss twiss changed the title Request: ES6 distributable modules Request: tree-shakeable ES6 distributable modules Apr 7, 2020
@twiss
Copy link
Member

twiss commented Feb 9, 2021

This is fixed in #1047, and will be in the upcoming V5 release :)

@twiss twiss closed this as completed Feb 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants