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

Build to ES module / enable tree shaking #110

Open
egasimus opened this issue Oct 11, 2022 · 1 comment
Open

Build to ES module / enable tree shaking #110

egasimus opened this issue Oct 11, 2022 · 1 comment

Comments

@egasimus
Copy link
Contributor

egasimus commented Oct 11, 2022

The current dist/browser.js is a monolithic minified CJS bundle.

It is my understanding that this format is only preferable if including SecretJS through a <script> tag -- but when using most forms of frontend build systems (Webpack, etc.) it prevents dead code elimination, considerably inflating the final bundle downloaded by the browser. In my case, [email protected] (and the similarly packaged [email protected]) account for nearly half the total bundle size - and we use just a few methods from the the bank and compute APIs...

I suggest it would be beneficial if the browser field in package.json pointed to an unminified and/or sourcemapped ESM build instead. That way the library users could do their own optimization.

Screenshot from 2022-10-11 03-05-39

@assafmo
Copy link
Member

assafmo commented Jan 24, 2023

Would love any contribution you can offer!

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

2 participants