Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove moment.js to improve bundle sizes #181

Open
missinglink opened this issue Feb 6, 2020 · 2 comments
Open

Remove moment.js to improve bundle sizes #181

missinglink opened this issue Feb 6, 2020 · 2 comments

Comments

@missinglink
Copy link

missinglink commented Feb 6, 2020

Hi,

We noticed that including moment.js (via pond and react-timeseries-charts) in our application added 500kb to the minified bundle.
This one library doubled the total size of our application and has a performance impact on page load times.

There is a thread over at moment discussing this issue.
At the bottom of the comments there are some alternatives suggested, which I can't comment on, but seem to be much smaller in size.

How tightly are pond / react-timeseries-charts coupled to the specifics of moment.js? would you consider using another library in order to remove half a meg from the builds?

@jedhastwell
Copy link

Screenshot 2020-02-06 at 11 21 58

@pjm17971
Copy link
Contributor

Yes, this has come up before. Thanks for the additional breakdown @jedhastwell.

The solution now is obviously to get off moment.js, which has been the only viable option up until recently. It has only got larger and the inability to separate out locales is killing its usefulness, at least on the client side. On top of this the maintainers don't seem to care about that and see it as a node.js library (at least that's been my take following this over the years). I guess that's their right.

Anyway, it would be possible to migrate now because date-fns seems to support timezones now. So I'll rename this item and leave it as a placeholder for that to hopefully happen down the road a bit.

A difficulty is that the 0.9.x branch of Pond, which is the dependency used by the current react-timeseries-charts code, is quite different from the 1.x branch of Pond, which will be used if the charts code ever gets ported to Typescript (there's an active project now to do that). So fixing this would be blocked by that work unless someone wants to step in and try to do the work on the 0.x code branch.

@pjm17971 pjm17971 changed the title Minified bundle size Remove moment.js to improve bundle sizes Feb 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants