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

Make modules tree-shakeable #17

Open
wbobeirne opened this issue May 1, 2019 · 1 comment
Open

Make modules tree-shakeable #17

wbobeirne opened this issue May 1, 2019 · 1 comment

Comments

@wbobeirne
Copy link

I haven't done extensive testing on this, so I may be wrong, but the way this package is currently set up isn't tree-shakeable by compilers that have that capability. This could be done by splitting files up and only importing what each export needs. The way I imagine this working is having an encode.js and a decode.js and having them import only the utility functions they need. The main file would simply be an export of those two (along with the other utility functions currently exported.)

This would also allow people who don't have tree shaking setup to import specific exports, like so:

import decode from 'bolt11/decode';

More info about Webpack's approach to tree shaking here: https://webpack.js.org/guides/tree-shaking/

@junderw
Copy link
Member

junderw commented May 1, 2019

Pull Requests are welcome!

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