nbd-wtf / js-lnurl

tools for adding lnurl support in a wallet
MIT License
30 stars 7 forks source link

Consider not exporting `decipherAES` from index for bundle size considerations #5

Closed wbobeirne closed 1 year ago

wbobeirne commented 1 year ago

I was just checking out the bundle size of js-lnurl and noticed that aes-js makes up more than half of it, but is only optionally used in an exported helper decipherAES which may not be relevant to all users of the library since it's only for LUD-10, or it may only be relevant in certain parts of people's applications and could be split into a separate chunk.

This should be easily remedied by removing the export * from index, and just requiring people to grab individual helpers from import { deciperAes } from 'js-lnurl/lib/helpers. Alternatively you could look into making the library more tree-shake friendly, although I'm not sure if that'll work or not since I don't believe aes-js is tree-shake friendly either.

Hopefully this shaves ~38kb off of most people's bundles!