Skip to content

Support Tree shaking  #165

@marcelltoth

Description

@marcelltoth

User story.
As a developer, I can use the pieces of ui-kit without bloating my package by including the entire bundle.

Is your feature request related to a problem?
See stoplightio/elements#376 for example. Elements uses parts of ui-kit, then the elements bundle gets very large as it imports all of @blueprintjs/core, even parts that it doesn't need.

Ninja has this problem, to a lesser degree. Lesser because I assume we use almost the entire ui-kit in ninja, but probably still not 100%.

Describe the solution you'd like
Implement dual ESM + CJS packaging. yalc into ninja to see if SSR support (CJS) is still intact.

Additional context
I have created an example project to demonstrate the issue: https://github.com/marcelltoth/bundle-size-test
This is a simple CRA template that includes a single button from ui-kit.

Using the current beta the resulting bundle looks like this:
image

I experimented with packing the same ui-kit as an ESM. Looks much better (35% improvement):
image

The second one still has the problem of including all blueprint icons, that's an open issue at palantir/blueprint#2193

Metadata

Metadata

Assignees

No one assigned

    Labels

    p/mediumNon-urgent issues/features that are candidates for inclusion in one of the upcoming sprints

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions