liveBook · Manning

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.

How 3 Manning books explain it

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.

Read how The Joy of JavaScript explains CommonJS →

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

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.