PKI.js
PKI.js copied to clipboard
Improve tree shaking
trafficstars
Why
I need to generate and then read X.509 certificate in browser. I wrote a function which does this and compiled it with:
esbuild --tree-shaking=true --outfile=test-cert.js --format=esm --bundle --main-fields=module,main --minify --sourcemap src/test-cert.ts
the output bundle is 376.9kb
With tree shaking disabled, the output is 396.4kb
What
Change the library structure to enable better tree-shaking support.