Node.js 中 module指一組程式碼組織成簡單或複雜的功能,可用來與其他程式碼互動。
在執行模組程式碼之前,Node.js 會使用 函數包裝器 (Module Wrapper) 將模組包起來:
(function(exports, require, module, __filename, __dirname){
// Module code actually lives in here
});
CJS 是 Node.js 最早期的模組規範,它和 Module Wrapper 的運作密不可分。