CommonJS module system

E131737

The CommonJS module system is a JavaScript module format that uses `require` and `module.exports` to structure and share code, most notably used in Node.js.

All labels observed (5)

Label Occurrences
CommonJS modules 2
CommonJS 1
CommonJS module system canonical 1

How this entity was disambiguated

Statements (48)

Predicate Object
instanceOf JavaScript module system
module format
alsoKnownAs CJS
CommonJS module system
surface form: CommonJS modules
cachingBehavior required modules are cached after first load
compatibility requires bundlers or transpilers to interoperate with ECMAScript modules in browsers
contrastsWith AMD module system
ECMAScript
surface form: ECMAScript modules
defaultExportPattern module.exports assigned to a single value
designedFor server-side JavaScript
designGoal simple server-side module semantics
dominantPeriod pre-ES6 era of JavaScript
executionModel modules executed at require time
exportMechanism assigning properties to exports object
assigning values to module.exports
granularExportPattern exports object used for multiple named exports
hasKeywordLike exports
module
require
importMechanism calling require with a module identifier
influenced JavaScript tooling design
Node.js
surface form: Node.js ecosystem
influencedBy server-side module patterns in other languages
interoperatesWith ECMAScript modules via Node.js compatibility rules
limitation not natively supported in web browsers without bundling
synchronous loading unsuitable for network-based module fetching
loadingStyle synchronous
moduleBoundary each file is treated as a separate module
moduleIdentifierType string path or package name
moduleScope file-based
notableImplementation Node.js
originatedIn CommonJS module system self-linksurface differs
surface form: CommonJS project
primaryUse sharing code between JavaScript files
structuring JavaScript code into modules
standardizationEffort CommonJS module system self-linksurface differs
surface form: CommonJS specification
stillWidelyUsedIn Node.js
surface form: Node.js LTS releases

existing Node.js libraries
supports synchronous module loading
supportsFeature circular dependencies with runtime resolution
conditional requires
dynamic requires using computed strings
typicalFileExtension .js
usedIn Node.js packages
many legacy JavaScript codebases
npm
surface form: npm ecosystem
usesFunction exports
module.exports
require

How these facts were elicited

Referenced by (6)

Full triples — surface form annotated when it differs from this entity's canonical label.

Node.js implements CommonJS module system
Expect.js compatibleWith CommonJS module system
this entity surface form: CommonJS modules
CommonJS module system alsoKnownAs CommonJS module system
this entity surface form: CommonJS modules
CommonJS module system originatedIn CommonJS module system self-linksurface differs
this entity surface form: CommonJS project
CommonJS module system standardizationEffort CommonJS module system self-linksurface differs
this entity surface form: CommonJS specification
bs-platform supportsModuleSystem CommonJS module system
this entity surface form: CommonJS