The full video and many others like it are all available as part of our Frontend Masters subscription.

Kent C Dodds

Kent C. Dodds works at PayPal as a full stack JavaScript engineer. He host JavaScript Air and co-hosts React30 podcasts. Kent is an Egghead.io instructor and Google Developer Expert.

Kent C Dodds

PayPal

Kent briefly walks through the ES6ify exercise which includes exporting a default View object from the view.js module and using import statements instead of require statement. Import statements allow developers to specify the exact object(s) they wish to import from a module rather than requiring the entire module. The code for this exercise is on the FEM/03.0-es6ify branch.
- http://slides.com/kentcdodds/webpack-deep-dive#/14/1

Get Unlimited Access Now

Kent C Dodds: Like I said, we're going to skip over the ES6 stuff. I'll just show you briefly that one just changes require statements, import statements. Now we can have import specifiers to pull out exactly what we want. This looks like that destructuring feature that I was telling you about. It is not.

It is not destructuring. You think that it is and then you cry when you find out it's not. I made a big, big mistake for a long time thinking that was that. Well, I knew it wasn't destructuring but I thought it worked like destructuring, and it doesn't. And so, if you want to learn more about that, check out the video I mentioned.

But yeah, that's pretty much all this one's doing. If you want to do this in your spare time later, then that is cool. But we're going to skip over that because it's not pertinent to web packing necessarily. One part about that that is important, is that for this Tree Shaking thing to work that I'm about to show you, your modules do you have to be ES6.

This doesn't work with require JS, it doesn't work with the CommonJS, and it doesn't work with AMD, or asynchronous model definition. If you're not familiar with that, don't worry about it. It's dying and nobody really uses that anymore. So yeah, you do have to use ES6.

Ready to take your code to the next level?

Intense courses with world-class teachers and unlimited access to our growing library of videos for the great price of $39 per month.

Get Unlimited Access Now