DEV Community

Discussion on: The Road to Modern JavaScript

Collapse
 
antonfrattaroli profile image
Anton Frattaroli

It poses some questions about current techniques. Is bundling good practice on a HTTP/2 enabled site? I suppose the focus would be on the waterfall: if your initial JS payload says it requires certain dependencies, then those are downloaded, and those files have dependencies and are downloaded... But on the other hand, you still want that minimum load for max performance on first load.

Web Assembly is scary, once it gains momentum the industry is going to take a long time to normalize. It'll make the JS ecosystem explosion look simple.

Thread Thread
 
ruidfigueiredo profile image
Rui Figueiredo

My understanding is that with http2 bundling is considered bad practice. The reason for this is that with http2 the limited number of connections is not an issue anymore, therefore there's no reason not to take advantage of browser features like caching.

Also, now there's no need to regenerate bundles just because there's a change in a JavaScript file.

Thread Thread
 
thatjoemoore profile image
Joseph Moore • Edited

In a perfect HTTP/2 world, bundling becomes an antipattern. That, however, basically depends on properly-implemented server push, where each file that gets pushed also causes its dependencies to get pushed. If you don't have server push, you can get into situations where you have deeply-nested dependencies and, while you're transferring everything over a single TCP connection, you still have to wait for the browser to discover that it needs a resource so that it can download it.

So, it kind of becomes a 'measure and see' kind of thing. I suspect that, for those environments without server-side push (like Amazon Cloudfront), we'll see a pattern emerge of no longer bundling all of your direct dependencies into one file, but bundling all of their dependencies with them.

Thread Thread
 
antonfrattaroli profile image
Anton Frattaroli

Just out of curiosity, I'd like to see the extent of the impact on Angular. Maybe they'd need another messy migration to a future version. I'd assume it would be less of an issue for a React app. I wouldn't really know regarding either.