plouc / nivo

nivo provides a rich set of dataviz components, built on top of the awesome d3 and React libraries
https://nivo.rocks
MIT License
13.16k stars 1.03k forks source link

Lodash bundled with Nivo BoxPlot component #2394

Open zac18992 opened 1 year ago

zac18992 commented 1 year ago

Is your feature request related to a problem? Please describe. Hey there. I noticed that Nivo Box Plot seems to be the whole Lodash library when I import it and use it in my libraries. Please see the bundle information below when I compile my library using Rolllup. Removing Nivo Box Plot does remove the Lodash bundle addition entirely.

I noticed a commit here in June: https://github.com/plouc/nivo/commit/9045e5e81b9b3ef2c39e0bce0afce6c25343c451

This seems to have already carried out the action which I believe would fix the issue, but I don't think any release was made in order for these changes to take effect.

Describe the solution you'd like Are these updates due to be released, or is there some other action that needs to be taken in order to make use of these changes?

Describe alternatives you've considered patch-package

Additional context

Rollup File Analysis
-----------------------------
...

█████░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
file:            .../node_modules/lodash/lodash.js
bundle space:    11.82 %
rendered size:   560.189 KB
original size:   544.096 KB
code reduction:  0 %
dependents:      4
  - .../node_modules/@nivo/core/dist/nivo-core.es.js
  - .../node_modules/@nivo/annotations/dist/nivo-annotations.es.js
  - .../node_modules/@nivo/colors/dist/nivo-colors.es.js
  - .../node_modules/@nivo/boxplot/dist/nivo-boxplot.es.js
belinde commented 1 year ago

I confirm the issue also with Bar, Line and Pie: I'm bundling my application with Vite, and the bundle importing Nivo is also loading the entirety of Lodash. The commit pointed out by Zac should fix the issue, IMHO

plouc commented 1 year ago

This has been solved already, but has not been released yet.

zac18992 commented 1 year ago

Thanks @plouc, sounds about right as per the original post.

Is there any suggested approach to using a stable version of this package which is contains the commit? Or the only way is to wait for a new release?

Thank you!

plouc commented 1 year ago

You'll have to wait for a new release @zac18992.

BrianHung commented 1 year ago

Is it possible to have a minor release with the lodash module fix? Running into deployment issues with out of memory from lodash being entirely bundled. @plouc

zac18992 commented 9 months ago

Hi @plouc as this code was already committed, is it going to be included in release https://github.com/plouc/nivo/releases/tag/v0.84.0 ? I couldn't see the changes in there.

Thank you.