Vue-chartjs: Entire Lodash Library Is Loaded!! 200kb chunk!

Created on 23 Aug 2017  ·  6Comments  ·  Source: apertureless/vue-chartjs

You are loading the entire lodash library which is added 200kbs to my webpack bundle.
Can you not just use the lodash.merge library or even use lodash-es library?

untitled_clipping_082317_040720_pm

improvement ✍ help wanted

All 6 comments

Oh I will check this. I am actually using import merge from 'lodash/fp/merge' and thought this will only load the merge function 🤔

There are 3 options, we can use the lodash.merge librar

  1. Use the lodash.merge library
  2. Use the lodash-es library
  3. Use another merge algorithm

I'll investigate and make a PR today!

Cheers!

Please be aware of this issue. Maybe it is related.

s/app.js 2.85 kB 13 [emitted] app
js/manifest.js 1.73 kB 14 [emitted] manifest
app.85248a3e60a89725a8ca01782364614a.css 157 kB 13 [emitted] app
index.html 1.09 kB [emitted]

ERROR in ./node_modules/vue-chartjs/es/helpers/options.js
Module not found: Error: Can't resolve 'lodash/fp/merge' in '/opt/build/repo/node_modules/vue-chartjs/es/helpers'
@ ./node_modules/vue-chartjs/es/helpers/options.js 8:13-39
@ ./node_modules/vue-chartjs/es/BaseCharts/Scatter.js
@ ./node_modules/vue-chartjs/es/index.js
@ ./src/components/PieChart.js

Will be fixed in the next release.

Lodash removed entirely as a dependency and replaced with Object.assign()

Yes because object.assign does not work for deep nested objects. And the chart options can have deep nested objects.

However now lodash.merge is a dependency and not lodash . Which results in smaller bundle size.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sylvaincaillot picture sylvaincaillot  ·  3Comments

gkatsanos picture gkatsanos  ·  3Comments

Sykomaniac picture Sykomaniac  ·  3Comments

Scalpel78 picture Scalpel78  ·  4Comments

humanismusic picture humanismusic  ·  3Comments