xaksis / vue-good-table

An easy to use powerful data table for vuejs with advanced customizations including sorting, column filtering, pagination, grouping etc
https://xaksis.github.io/vue-good-table/
MIT License
2.17k stars 404 forks source link

Moment.js might produce big bundles #7

Closed cristijora closed 7 years ago

cristijora commented 7 years ago

Moment.js is well known for a very high size There are many issues around this https://github.com/moment/moment/issues/2373 I saw that vue-good-table uses moment only to format dates in a couple of places A good alternative for such operations is https://github.com/date-fns/date-fns

With date-fns you can import only the functions you need (e.g format) and not import the whole library to do this operation. This helps a lot reducing the overall vue-good-table size when used in production.

Update: Here is some proof: Simple app (vue-cli wepback with vue only) clean

As you can see the vendor file has 60kb which contains only Vue basically

Same app with a very basic vue-good-table added vue-good-table

Size went up from 60kb up to 688 kb because of moment.js

xaksis commented 7 years ago

Thank you for bringing this up @cristijora. Makes a lot of sense. Looking into it.

xaksis commented 7 years ago

v1.5.2 replaced moment with date-fns parse/format functions. Thank you @cristijora for the recommendation!