1
00:00:02,490 --> 00:00:04,530
And this is it for modules,

2
00:00:04,530 --> 00:00:09,040
an extremely important feature for serious Javascript projects.

3
00:00:09,120 --> 00:00:15,690
Having all your code in one file quickly makes it hard to maintain and read, having manual imports in

4
00:00:15,690 --> 00:00:17,030
the index.html file

5
00:00:17,070 --> 00:00:23,250
on the other hand means a lot of micromanagement and it can easily become an error source. With modules

6
00:00:23,340 --> 00:00:27,060
which you unlock by adding type module and by using a web server,

7
00:00:27,060 --> 00:00:32,250
even if it's just a dummy one for development, with modules you get rid of that because there every

8
00:00:32,250 --> 00:00:36,890
Javascript file states its dependencies and has its own import

9
00:00:36,900 --> 00:00:42,150
so to say. Now you can only import what you export with the export keyword,

10
00:00:42,240 --> 00:00:48,390
either with such a named export where you're just throw export in front of your class, function, constant

11
00:00:48,390 --> 00:00:54,330
or variable or with a default export, something you can also do and which we did in the component.js

12
00:00:54,330 --> 00:00:55,470
file for example.

13
00:00:55,650 --> 00:00:59,250
You can have both named and default exports in the same file

14
00:00:59,250 --> 00:01:02,780
and when it comes to importing, you also got a lot of flexibility.

15
00:01:02,850 --> 00:01:06,780
You can import named exports without or with an alias,

16
00:01:06,870 --> 00:01:13,770
you can bundle all exports together or of course, you can also import default exports and named exports

17
00:01:13,780 --> 00:01:15,150
at the same time.

18
00:01:15,300 --> 00:01:22,140
Last but not least, we also had a look at the dynamic import which can help you split your code and download

19
00:01:22,140 --> 00:01:22,500
things

20
00:01:22,530 --> 00:01:27,640
only when you need them instead of in advance and that's it for modules.

21
00:01:27,660 --> 00:01:33,540
Modules are a core feature and in the next course section, we'll build upon this knowledge and see how

22
00:01:33,540 --> 00:01:35,310
we can improve them even more.
