tremorlabs / tremor

React components to build charts and dashboards
https://npm.tremor.so
Apache License 2.0
16.23k stars 467 forks source link

termor adds 800kb to remix bundle #383

Closed bjruberg closed 1 year ago

bjruberg commented 1 year ago

I investigated a quite impressive addition to the JS bundle by importing three tremor components.

image

I was surprised to see that the imported file node_modules/@tremor/react/dist/esm/index.js is 1.2MB in size and seems to include several external libraries like react-dom.production.min.jsm

This seems unintended and explains the huge amount of bytes.

mitrotasios commented 1 year ago

Hey thanks for sharing this, we'll investigate this further!

ducan-ne commented 1 year ago

I got the same issue with Vite, tremor adding 1m1 MB to bundle. Contains 2 version of react-dom, which is crashing my (only) prod environment. Just spent a day in investigating to understand this 🙏

ducan-ne commented 1 year ago

It contains another react-dom from 2.0.0

CleanShot 2023-04-10 at 02 29 29@2x
mitrotasios commented 1 year ago

Thanks all for looking into this! Turns out react-transition-group had listed react-dom as a peerDep and we hadn't added it to our peerDeps. Should be fixed with v2.2.0

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 2.2.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

bjruberg commented 1 year ago

I just see a minor improvement from 800kb to 682kb. The index.js files in dist still contain the code for classNames and react 16.

Also treeshaking fails for me using remix/esbuild.

grafik

github-actions[bot] commented 1 year ago

:tada: This issue has been resolved in version 2.4.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

mitrotasios commented 1 year ago

should be fixed with v2.4.0