Module Patterns in JS - CommonJS, AMD and ES6 classes

  • IIFE pattern

  • Module Patterns (Common JS, AMD pattern)

  • ES6 Classes

Quick Scribblings

CommonJS = is a specification for a module format/pattern in javascript where dependencies between two modules is defined or established using the keywords 'exports' and 'require' .

SystemJS & RequireJS are module loaders that are built using the implementation of few module pattern specifications including CommonJS (they also support other module formats like AMD and ES6)

AMD (Asynchronous Module Dependency) Pattern

let myModule = new module( [module1, module2], function(){
});

Last updated