-
Notifications
You must be signed in to change notification settings - Fork 3
Description
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:

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

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