DEV Community

The Road to Modern JavaScript

Rui Figueiredo on August 16, 2017

When I recently decided to learn webpack I realized just how many new things were added to the JavaScript ecosystem in the last couple of years. Th...
Collapse
 
thatjoemoore profile image
Joseph Moore

Good news on the ES6 modules front - while you still have to use something like Webpack for other browsers, Safari has already shipped support, and Chrome is shipping them in Chrome 61, which is coming in the next couple of weeks. Firefox and Edge both have experimental versions hidden behind config flags. 🎉

Collapse
 
martyonthefly profile image
Sylvain Marty

Really good article ! It explains a lot of internal concept of popular JS framework (like Angular). The dependency injection from Angular (v1.6 in my case) looks particularly like the AMD way !

Thanks for sharing ! :)

Collapse
 
antonfrattaroli profile image
Anton Frattaroli

http2 supposed to get around the concurrent requests issue. Although for IIS hosted, you'll need Server 2016.

Collapse
 
ruidfigueiredo profile image
Rui Figueiredo

You are absolutely right. It's funny, yesterday I listened to a podcast about this exactly: devchat.tv/js-jabber/http-2-with-s...

It was very informative.

One of the other new things that are gaining momentum is web assembly. Check this video: youtu.be/MiLAE6HMr10

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.

Collapse
 
borismoser profile image
Boris

Excellent! I'm starting to learn js and your article is going to be very useful.