CommonJS
CommonJS is a JavaScript module-system specification that defines how modules export and load values, traditionally using synchronous require calls and module.exports assignments.
The Joy of JavaScript
A server-side JavaScript module specification that defines modules using synchronous loading and the require/module.exports convention.
- How it is used
- Deploys programmatic, conditional module loading and API consumption through require and exported values.
- How deep it goes
- Explains dynamic loading, exports, copied destructured values, and conditional selection, while contrasting but not fully detailing ESM internals.
- Examples
- Uses calculator exports, Transaction loading, validation imports, filesystem imports, and feature-flagged wallet implementations.
- What you can do after
- Apply it via Node.js by defining exports, consuming modules with require, and selecting dependencies conditionally.
Secrets of the JavaScript Ninja, Second Edition
A JavaScript module system that defines reusable modules with synchronous loading, commonly used in Node.js.
- How it is used
- Organizes growing JavaScript applications into reusable modules with public interfaces, particularly in server-side environments.
- How deep it goes
- Shows module definition and consumption through require and module.exports, but leaves project setup beyond scope.
- Examples
- Uses a jQuery-dependent click-counter module and a require call that invokes its exported method.
- What you can do after
- Build it from scratch using require for dependencies and module.exports for a public interface.
Read how Secrets of the JavaScript Ninja, Second Edition explains CommonJS →
Essential TypeScript 5, Third Edition
CommonJS is a JavaScript module system specification for defining and loading modules, especially in server-side environments.
- How it is used
- Organizes multi-file JavaScript applications and supplies Node.js with a supported module format.
- How deep it goes
- Explains its history, configuration, and TypeScript-generated require output, but does not detail the full CommonJS specification.
- Examples
- Uses split TypeScript files, an exported sum function, generated require code, package.json settings, and a Total: 600 output.
- What you can do after
- Operate/configure Node.js projects by selecting CommonJS and recognizing TypeScript output that uses require and exports.
Read how Essential TypeScript 5, Third Edition explains CommonJS →
Related concepts
- Node.jsuses · Node.js is an open-source JavaScript runtime built on the V8 engine that executes JavaScript outside web browsers and provides APIs for system and network operations.
- AMDalternative to · Asynchronous Module Definition (AMD) is a JavaScript module format that specifies modules and their dependencies for asynchronous loading.
- modulealternative to · A module is a distinct, bounded software unit that groups related code or functionality and provides an organizational or interaction boundary within a larger system.
- requireuses · require is a CommonJS function that synchronously loads a module and returns its exported value.
- type propertyconfigured by · The type property is a package.json setting that declares the module system used by a JavaScript package.
These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.


