Closed
Description
Expected Behavior
Chart.js requires moment.js but only uses some of its functions. The moment.js size is too large for production. I want to reduce the bundle size by using a date-time library supporting tree-shaking
Current Behavior
I have a problem with the bundle size of moment.js in production. Moment.js does not support tree-shaking so its size is kinda overwhelming.
Possible Solution
Using date-fns instead of moment.js. Date-fns offers similar APIs and support tree-shaking. There are some comparisons between date-fns and moment.js
- Add a brief comparison with Moment.js? date-fns/date-fns#275 (comment)
- Add a brief comparison with Moment.js? date-fns/date-fns#275 (comment)
- Modularize moment.js, make the core as light as possible moment/moment#2373 (comment)
Context
Chart.js is the only library requiring moment.js in my application. I did some searches and date-fns seems to be a decent choice.
Environment
- Chart.js version: 2.5.0
- Browser name and version: Chrome v59.0.3071.29