Live data from Hacker News

You Don't Need Moment.js

github.com

51–60 of 91 posts

Re: You Don't Need Moment.js

#51

Earlier quoted context omitted.

it depends on who will be downloading the bundle. if it's a group of consistent users primarily using desktop browsers, it may not be worth worrying about since they'll probably download it once at a fast speed and reuse from the cache repeatedly afterwards. if you have lots of new users on mobile using slow cellular connections, big libraries like moment.js add up and can really hurt load times and make for a poor u…

I think mobile phones have browser cache too.

sorry, i shouldn't have mentioned caching. the emphasis should have only been on connection speed

Re: You Don't Need Moment.js

#53

I really don't understand this... while yes, I might at some point be interested in reducing my bundle size, for 99% of developers out there, a difference in 300kb is just completely irrelevant. I choose my JS libraries because they are actively maintained, have well designed APIs (easy to use), are common enough to where newly hired developers already know them, and just generally make my life easier. This doesn't a…

I wonder how many seconds it takes to load your site on mobile when you think 300KB is irrelevant in your product.

From users point of view, it's irrelevant what you use inside but how snappy things are.

Re: You Don't Need Moment.js

#55

Earlier quoted context omitted.

After gzipping none of the variants are that large, and let's be real: the 3rd party ads and analytics and cat pictures are gonna strictly dominate the load time.

Cat pictures don't interfere with my ability to interact with the web page. The 2MB+ of bloated, unoptimised JS that you ship with your page that I need to parse and render before I'm allowed to see the 20kb of actual content _does_ interfere with my ability to use the page.

The library in question is nowhere near 2MB. You're tilting at windmmills.

Re: You Don't Need Moment.js

#56

Earlier quoted context omitted.

Cat pictures don't interfere with my ability to interact with the web page. The 2MB+ of bloated, unoptimised JS that you ship with your page that I need to parse and render before I'm allowed to see the 20kb of actual content _does_ interfere with my ability to use the page.

The library in question is nowhere near 2MB. You're tilting at windmmills.

It also won't be the only dependency.

Re: You Don't Need Moment.js

#57

Whenever a "you might not need this heavy, popular lib" gets posted to HN, the responses are always pretty divided. I always try and write my own functions and import things like lodash, underscore, jQuery, and moment as a last resort. Bundle size may not be that important to the people working on prototypes and side projects, but it certainly is to many other people. If a library is heavy, it is in their interest to…

I’ve picked up node and js more seriously recently, coming from .Net and C# and I’ve been wondering why people in my learning material are relying so much on third party libraries for very basic things.

I’m probably a little old fashioned, but I didn’t even know moment existed and I’ve been fooling around quite a bit with JS dates recently. It didn’t take a long time to write the .ToString(dd-MM-yyyy) module, that was the only thing I really needed aside from the standard library, but I guess it would’ve been faster to import moment.js.

Re: You Don't Need Moment.js

#58

But react-dates has moment as dependency, so…

https://github.com/airbnb/react-dates/blob/master/package.js... A devDependency is not the same as a dependency.

It's a dev dependency because they use it in unit tests but it's also a peer dependency, meaning that if you want to use the library you need to include moment.

Re: You Don't Need Moment.js

#59

I really don't understand this... while yes, I might at some point be interested in reducing my bundle size, for 99% of developers out there, a difference in 300kb is just completely irrelevant. I choose my JS libraries because they are actively maintained, have well designed APIs (easy to use), are common enough to where newly hired developers already know them, and just generally make my life easier. This doesn't a…

https://infrequently.org/2017/10/can-you-afford-it-real-worl...

https://infrequently.org/2018/09/the-developer-experience-ba...

https://medium.com/@addyosmani/the-cost-of-javascript-in-201...

Re: You Don't Need Moment.js

#60

Whenever a "you might not need this heavy, popular lib" gets posted to HN, the responses are always pretty divided. I always try and write my own functions and import things like lodash, underscore, jQuery, and moment as a last resort. Bundle size may not be that important to the people working on prototypes and side projects, but it certainly is to many other people. If a library is heavy, it is in their interest to…

I’ve picked up node and js more seriously recently, coming from .Net and C# and I’ve been wondering why people in my learning material are relying so much on third party libraries for very basic things. I’m probably a little old fashioned, but I didn’t even know moment existed and I’ve been fooling around quite a bit with JS dates recently. It didn’t take a long time to write the .ToString(dd-MM-yyyy) module, that wa…

I've definitely made my peace with it. Think of it this way: how much better is a bunch of imports than the slew of stackexchange copy-pasta you'd find in an old PHP app?
Post reply on HN