JavaScript Module Formats
How JavaScript code (function) is structured into a module that can be loaded by Module loader at runtime in correct dependency order. This is just a convention followed in plain js to form Modules.- AMD Format (Asynchronous Module Dependency) - primarily used in Browser js since it has the advantage of being async loading. define function is used to load dependencies.
- CommonJS Format - more prevalent in server (nodeJs) apps. require function is used to load dependencies.
- Universal Module Definition (UMD) - Has both the features of AMD and CommonJS
- System.register - Specific to SystemJS module loader
- ES2015 - Native support in ES6 - Need to use something like Babel to use in current browsers
JavaScript Module Loaders
JavaScript libraries that load modules (specified in supported format) while honoring the dependencies.- RequireJS Module Loader can load modules in AMD Format
- SystemJS Module Loader can load modules in CommonJS Format