Vue-good-table: Moment.js might produce big bundles

Created on 3 Jun 2017  路  2Comments  路  Source: xaksis/vue-good-table

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

Most helpful comment

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

All 2 comments

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

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

luizzz picture luizzz  路  6Comments

jonathan-wondereur picture jonathan-wondereur  路  6Comments

Sharvadze picture Sharvadze  路  4Comments

advicepyro picture advicepyro  路  3Comments

unixconky picture unixconky  路  4Comments