1. History of development
2. Modular specification
(1) [Back-end] commonJS (see node)
(2) [Front end] AMD (require)
(3) [Front end] CMD (sea is not commonly used)
(4) [Front end] ES6 (the most commonly used front end)
See es6 notes
3. Summary
The CommonJS specification is mainly used for server-side programming, and the loading module is synchronous, which is not suitable for the browser environment, because synchronization means blocking loading, and browser resources are loaded asynchronously, so there is an AMD CMD solution.
AMD specification loads modules asynchronously in the browser environment, and multiple modules can be loaded in parallel. However, AMD specification development costs are high, code reading and writing are difficult, and the semantics of the module definition method is not smooth.
The CMD specification is very similar to the AMD specification. Both are used for browser programming, relying on the nearest, delayed execution, and can be easily run in Node.js. However, relying on SPM packaging, the loading logic of the module is biased
ES6 implements module functions at the level of language standards, and the implementation is quite simple, which can completely replace CommonJS and AMD specifications and become a common module solution for browsers and servers.