On the concept of COMMONJS/AMD/CMD/UMD

Source: Internet
Author: User

1, Commonjs is a kind of specification, NODEJS is the realization of this kind of norm.

1.1, CommonJS loading module is synchronous, so only the loading is complete to perform the subsequent operation.

2, AMD is REQUIREJS in the promotion process of the module definition of standardized output.

2.1, AMD asynchronous loading module.

3, CMD is seajs in the promotion process of the module definition of standardized output.

3.1, for the dependent module AMD is executed in advance, CMD is deferred execution. However, starting from 2.0, the Requirejs is also changed to be deferred (depending on how it is written, the processing does not pass).

3.2, the CMD respected rely on the nearest, AMD respected relying on the front.

4, UMD is the integration of AMD and COMMONJS.

4.1, AMD Browser The first principle of development of asynchronous loading module.

4.2, CommonJS module to the server first principle of development, choose synchronous loading, its modules without packaging (unwrapped modules).

4.3, this forces people to come up with another more general pattern UMD (Universal Module Definition). Want to solve the cross-platform solution. UMD first determines whether the module (exports) that supports node. JS is present, and the node. JS module pattern exists. In determining whether AMD is supported (define exists), the module is loaded using AMD mode.

The above is about the concept of JS understanding, follow-up in a deep attempt.

Reference:

Http://javascript.ruanyifeng.com/nodejs/module.html

Http://www.cnblogs.com/fullhouse/archive/2011/07/15/2107416.html

https://justineo.github.io/singles/writing-modular-js/

Https://my.oschina.net/felumanman/blog/263330?p=1

http://web.jobbole.com/82238/

Http://blog.gejiawen.com/2015/11/03/what-is-amd-cmd-commonjs-umd/?utm_source=tuicool&utm_medium=referral

https://www.zhihu.com/question/20351507

Http://www.cnblogs.com/mfc-itblog/p/5216820.html

1. For dependent modules AMD is performing ahead of time, and CMD is deferred execution. However, starting from 2.0, the Requirejs is also changed to be deferred (depending on how it is written, the processing does not pass).

2.CMD is highly dependent on proximity, AMD is highly reliant on pre-built.

On the concept of COMMONJS/AMD/CMD/UMD

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.