O'Reilly logo

Node.js Web Development - Third Edition by David Herron

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A quick note about CommonJS

The Node.js package format is derived from the CommonJS module system (http://commonjs.org). When developed, the CommonJS team aimed to fill a gap in the JavaScript ecosystem. At that time, there was no standard module system, making it trickier to package JavaScript applications.

The require function, the exports object, and other aspects of Node.js modules come directly from the Modules/1.0 spec.

With ES2015, the JavaScript community now has a native module format which is different than the CommonJS spec. At the time of writing this, Node.js does not support that format. If you wish, Babel supports transpiling from the new modules format to the Node.js format.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required