Skip to content

Do not require moment.js #4303

Description

@hiendv

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

screenshot from 2017-05-29 17-55-24
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

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions