nivo icon indicating copy to clipboard operation
nivo copied to clipboard

Lodash bundled with Nivo BoxPlot component

Open zac18992 opened this issue 2 years ago • 6 comments

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

zac18992 avatar Jul 21 '23 08:07 zac18992

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

belinde avatar Jul 25 '23 11:07 belinde

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

plouc avatar Jul 26 '23 19:07 plouc

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!

zac18992 avatar Aug 22 '23 12:08 zac18992

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

plouc avatar Sep 06 '23 21:09 plouc

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

BrianHung avatar Sep 22 '23 20:09 BrianHung

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.

zac18992 avatar Jan 12 '24 11:01 zac18992