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.