Check out a free preview of the full Complete Intro to React, v3 (feat. Redux, Router & Flow) course:
The "Setting Up Import" Lesson is part of the full, Complete Intro to React, v3 (feat. Redux, Router & Flow) course featured in this preview video. Here's what you'd learn in this lesson:

To enable Babel, Webpack, and Node to all understand the import(…) syntax, Brian includes a few more plugins in babelrc: one plugin for Babel to understand import at all and a plugin to transform Webpack to know to split.

Get Unlimited Access Now

Transcript from the "Setting Up Import" Lesson

[00:00:00]
>> Brian: So I'm gonna need you to go back to you double RC real quick. We have react-hot-loader/babel. And then underneath that we are gonna have to add two more plugins right here. One of them is going to be babel-plugin,
>> Brian: -dynamic, -import-webpack
>> Brian: What this is going do is that it's just going to allow webpack to understand.

[00:00:35]
>> Brian: No, that's the second one, so this is the second one, the first one is this one babel-plugin-syntax-dynamic-import, yep, that's it. So the first one, this one right here, just lets babel understand the import syntax, right. Without this, it just throws in errors, like I'm seeing imports somewhere I don't expect it, right.

[00:01:06] The second thing is actually going to translate it to something that web pack understands, which, if you wanna know, is require.insure. So it's gonna translate our impact. Import, import statements to require.insure, cuz WebPack already understands and knows what to do with require.insure, but that's the old way of doing it.

[00:01:26] And we're gonna do it with the brand new way of doing it, which is import functions.
>> Brian: This is a pretty new way of doing imports, but this is actually the standards way of doing it. I think it's stage three, if I remember correctly. And a lot of.

[00:01:43] I know the latest version of Chrome has already implemented dynamic import. I think it might be behind a flag, but it's there. So that's cool.