CommonJS is a project with the goal to establish conventions on the module ecosystem for JavaScript outside of the web browser. The primary reason for its creation was a major lack of commonly accepted forms of JavaScript module units which could be reusable in environments different from that provided by conventional web browsers running JavaScript scripts (e.g. web servers or native desktop applications).
CommonJS's module specification is widely used today, in particular for server-side JavaScript programming with Node.js.[1] It is also used in the development of browser-side JavaScript, but the code must be packaged with a transpiler since browsers don't support CommonJS.[1] The other major server-side module specification in use is the ES modules specification (ES6 modules aka ES2015 modules).[2] CommonJS can be recognized by the use of the require()
function and module.exports
, while ES modules use import
and export
statements for similar (though not identical) functionality.
The project was started by Mozilla engineer Kevin Dangoor in January, 2009 and initially named ServerJS.[3]
What I’m describing here is not a technical problem. It’s a matter of people getting together and making a decision to step forward and start building up something bigger and cooler together.
— Kevin Dangoor[3]
In August 2009, the project was renamed CommonJS to show the broader applicability of the APIs.[4] Specifications are created and approved in an open process. A specification is only considered final after it has been finished by multiple implementations.[5] CommonJS is not affiliated with the Ecma International group TC39 working on ECMAScript, but some members of TC39 participate in the project.[6]
The list of specifications includes:[7]
The proposals cover much more than modules. They intend to define a set of APIs that are useful both for non-web JavaScript implementations, with standardized package names to provide interoperability within the ecosystem. This goal sometimes overlaps with that of TC39, and parts such as Promises have indeed made it into ECMAScript itself.
The part after the slash is the version. When a proposal is in contention, each individual proposal (including sequential revisions from the same author) is assigned a new letter. When the main direction is known it starts being assigned numeric versions.
By: Wikipedia.org
Edited: 2021-06-18 12:37:02
Source: Wikipedia.org