ES6 module and COMMONJS, AMD essential Difference thinking

Source: Internet
Author: User

Commonjs and AMD essentially define a namespace with a global variable

Take Sea.js as an example, each module outputs an object, and the object is mounted under the Seajs.cache property, and each module exists as an object.

While the ES6 module is not, the module object does not exist when the module is not referenced.

Commonjs and AMD are run-time loaded, ES6 modules are loaded at compile time

This distinction can explain the difference, which is the most essential source of the difference.

Commonjs and AMD to load a module must first let the module execute (see the network can see the loading of the corresponding JS file), and ES6 at compile time to complete the load.

ES6 module and COMMONJS, AMD essential Difference thinking

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.