r/webdev • • Feb 13 '19

Bootstrap 5 will remove jQuery as a dependency

https://github.com/twbs/bootstrap/pull/23586
1.5k Upvotes

398 comments sorted by

View all comments

Show parent comments

6

u/timeshifter_ Feb 13 '19

750KB vs 86KB.

And you claim to be worried about bloat.

11

u/spryes Feb 13 '19

750 KB? Where'd you get that from?

React + ReactDOM is ~35 kB minzipped and jQuery slim is ~24 kB minzipped.

It's recommended that first load JS does not exceed about 150 kB minzipped (parsing/compiling is especially expensive on slow devices), adding a jQuery dependency is pretty annoying.

-11

u/[deleted] Feb 13 '19

create-react-app is around 250MB, oh wait did I learn the wrong react?

5

u/spryes Feb 13 '19

Uhh yes you did, if you think a development build tool setup is the same as React's production size shipped to users

-6

u/[deleted] Feb 13 '19

definitely it will be production size

but since I am still new to react, can you link me something to the production build?

something like this ? https://unpkg.com/react-dom@16/umd/react-dom.production.min.js

or npm run build

https://reactjs.org/docs/optimizing-performance.html

and https://reactjs.org/docs/cdn-links.html

1

u/gijovarghese Feb 13 '19

"somebody doesn't understand that jQuery". I know there are many 'somebody' on Facebook to understand what's the difference b/w JQuery and React.

-3

u/gijovarghese Feb 13 '19

I've to use that 750KB anyway. Why should I add another 86KB?

-6

u/timeshifter_ Feb 13 '19

And that's just the react-dom library.

Just sayin'. You can't really complain about bloat when your chosen DOM library is 9x the size of the one you're complaining about.

13

u/spryes Feb 13 '19

750 KB is the unminified development version of react-dom. The version users actually download is about 33 kB over the wire. It's completely disingenuous because users don't download that version on a production website. It has tons of source comments and warnings useful for development which makes it so large.

-4

u/lovestheasianladies Feb 13 '19

...and the size of jQuery is insanely small for the gzipped version too.

What's your point?

5

u/spryes Feb 13 '19

Point 1: He was being dishonest about the size of React (9x bigger? It's around 1.45x actually)

Point 2: Size-conscious devs have a hard time including a fairly large dependency that they don't directly use, it feels like a waste

Point 3: It takes up 16% of the initial payload size budget and takes up 50ms of parse/compile time on slow CPUs when it doesn't need to (all of Bootstrap's JS can be written with the plain DOM API with equal browser support, there's no need to use jQuery in 2019)

2

u/rackmountrambo full-stack Feb 13 '19

Also size conscious devs generally build the resources with webpack eliminating many unused facets of the library.

1

u/noknockers Feb 13 '19

How big it is?

1

u/dasfsi Feb 13 '19

Well, now they have to download almost twice as much stuff for barely any benefit

1

u/[deleted] Feb 13 '19

I’ve built web projects for very large video game industry companies. Library size of any sort is a huge thing. We can’t introduce anything the company isn’t already using. All of our own library tools are written in pure JS and thus are super lean because we have to consider page load on pages that millions of users will see.

If it’s a smaller site for some local company, the end size of whatever you’re delivering might not be a big deal. In the case of building a product for that many users, every bit counts. The idea of even wanting to introduce a new library can turn into a scheduled dev meeting.

3

u/gijovarghese Feb 13 '19

Decluttering dependencies is always good. It's one's decision to choose which library/framework. The size of the library, whether its a few bytes or megabytes, its just one factor while picking a library/framework. There are a lot of other factors.

Yes, I agree, JQuery is lightweight than React. That doesn't mean I've to use JQuery.