AMD vs native JavaScript modules. Time to migrate.
For example, terminology. How to call them when searching some information in Google — JavaScript, JS, ECMAScript, ES or ES6 modules? In this post I stick to the Node.js documentation choice— ES modules.
ES modules can be used directly in a browser starting from 2018, but until 2021 it was too impractical. Without import maps and top level await
, ES modules needed additional processing by Node.js-based transpilers and then bundlers. Not everyone wanted to spend time on nonstop builds and needlessly complicated debugging.
For years the developers who wanted to enjoy modular code and quick development directly in a browser have used custom module loaders. RequireJS is probably the most popular tool implementing straightforward Asynchronous Module Definition (AMD) specification.
If you are a beginner and you have never heard of AMD, today you do not really need to take an interest in AMD. Lately the situation has changed. It is fair to say that ES modules have caught up with AMD and are even easier to use than AMD.
And the developers who loved AMD, should start considering further facilitating their work by migration from AMD to ES modules. The migration is quite straightforward…