JavaScript itself, in its initial version, had no module system whatsoever baked into the language. With time, some module systems were created. The most popular standards were:

  • CommonJS Modules - these are the ones implemented in Node.js

  • Asynchronous Module Definition (AMD) - a popular implementation of this standard is RequireJS. We don't care about AMD at all as it's dead.

Eventually with time it was obvious that a module system would have to be introduced to the language natively, so ECMAScript 6 (ES6) Modules were created. This is what we've been using in this course. We could dive deep into the differences between CommonJS and ES6 Modules, but this knowledge isn't essential to our course - although a simple snippet to compare them wouldn't hurt, would it?

Here we go.

Named exports and imports:

Default exports and imports:

Start a new discussion. All notification go to the author.