Hacker News new | ask | show | jobs
by yread 504 days ago
why does the polyfill have dependencies? And it's 200KB alone compared to 60KB of moment.
2 comments

Did you bother to look at it?

It has a single dependency, and that single dependency has no dependencies of its own.

So what is that dependency?

"temporal-spec"

And it looks like it comes from the same github repo. It basically looks like they broke out the API definitions so that they could be depended on by other potential implementations. This isn't atypical.

Oh sorry I was looking at https://www.npmjs.com/package/@js-temporal/polyfill

this one looks much better indeed

If payload size is the top concern you shouldn't be using Moment either though. Luxon and DayJS are both considerably smaller (their uncompressed size is about what Moment's compressed size is) and the date-fns library is much, much smaller and also tree-shakeable. Moment also performs at or near the bottom of all available options if speed is a concern. Other than reflexive popularity or the cost already being paid there's not really a good reason to use it anymore.
Exactly. I should've written even compared to moment