Skip to content

Make modules tree-shakeable #17

Description

@wbobeirne

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/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions