Generated by GPT-5-mini| CommonJS | |
|---|---|
| Name | CommonJS |
| Developer | Various contributors |
| Initial release | 2009 |
| Written in | JavaScript |
| Platform | Cross-platform |
| License | Various |
CommonJS
CommonJS is a widely referenced specification for server-side and non-browser JavaScript module conventions developed to enable modular Node.js-style environments and interoperable APIs across runtimes. It arose from coordination among contributors affiliated with projects like Mozilla Foundation, Microsoft, Google, Facebook, and organizations such as the OpenJS Foundation and Apache Software Foundation. The specification influenced ecosystems including npm, Node.js, Rhino, Electron, and implementations used in platforms like Adobe Systems and IBM.
The effort began during discussions involving developers from Mozilla Foundation, Sun Microsystems, Microsoft, Google, and independent authors who had worked on projects such as Node.js, Rhino, Nashorn, and RingoJS. Early meetings and proposals referenced module approaches used in Common Lisp and Python and drew community input from contributors to npm, Apache CouchDB, Couchbase, MongoDB, and Redis-adjacent tooling. Influential figures in JavaScript engineering from organizations like Yahoo!, Facebook, PayPal, and GitHub participated in defining goals for server-side scripting, package management, and cross-project APIs during conferences such as JSConf, Node Interactive, and JsNation.
The specification defines synchronous module loading, explicit exports, and an API surface for modules intended for non-browser contexts used by implementers like Node.js', RingoJS, and Narwhal. It prescribes semantics for require-style resolution influenced by patterns in Unix packaging and module systems in RubyGems and CPAN. Proposals discussed interoperability with standardized formats championed by stakeholders from ECMA International, including delegates who worked on ECMAScript editions, and referenced prior work by contributors associated with V8, SpiderMonkey, ChakraCore, and JavaScriptCore. Governance and editorial direction involved participants from OpenJS Foundation and contributors from corporate entities such as IBM, Microsoft Azure, Google Cloud Platform, and Amazon Web Services.
The module API specifies the require function, module identifier resolution, module caching, and the module.exports contract used by runtime implementers including Node.js and runtime-adjacent projects like Electron, NW.js, Apache Cordova, and Adobe AIR. The resolution algorithm and semantics were compared with patterns in Common Lisp, Perl, Python, Ruby, and package managers like npm, Yarn, Bower, and Composer. Implementations had to consider interoperability with tooling authored by teams at GitHub, Bitbucket, Atlassian, JetBrains, and Microsoft Visual Studio Code.
Multiple implementations exist across projects and vendors: Node.js adopted the module API and became a primary driver of the ecosystem; other engines such as Rhino and Nashorn provided compatible shims; server frameworks like Express.js, Koa, Hapi, and Sails.js built on the convention; bundlers and build tools from Webpack, Browserify, Rollup, and Parcel provided compatibility layers; package and registry services like npm, Yarn, Verdaccio, and GitLab supported distribution. Major corporations including Netflix, PayPal, Uber, LinkedIn, Walmart Labs, Airbnb, Etsy, and Twitter developed production systems relying on the module conventions and related tooling for microservices, server-rendering, and desktop applications via Electron.
The CommonJS synchronous, mutable-exports model was contrasted with the static, declarative semantics of ECMAScript Modules devised by contributors to ECMA International, such as participants working on ECMAScript 6 and later editions. Debates involved parties from Mozilla Foundation, Google, Microsoft, and Apple engineers responsible for runtime engines like V8, SpiderMonkey, JavaScriptCore, and ChakraCore. Tooling authors from Webpack, Babel, Rollup, and TypeScript played roles in bridging differences through transpilation, interop layers, and hybrid packaging used by organizations like Google Cloud Platform, Amazon Web Services, and Microsoft Azure.
Adoption was driven by large-scale projects and companies including Netflix, LinkedIn, PayPal, Uber, Airbnb, GitHub, and Facebook that standardized on the module pattern for server-side JavaScript, tooling, and package distribution. The specification influenced package ecosystems maintained by npm, Yarn, and registries operated by npm, Inc. and hosted services like GitHub Packages and GitLab Package Registry. Academic and industrial research groups at institutions such as MIT, Stanford University, UC Berkeley, and Carnegie Mellon University cited the practical effects of modular JavaScript in systems research on serverless, edge computing, and distributed systems. The module conventions shaped best practices adopted by developer communities at JSConf, Node Interactive, dotJS, and ECMAScript-oriented workshops.