AMD规范
define("alpha", [ "require", "exports", "beta" ], function( require, exports, beta ){ export.verb = function(){ return beta.verb(); } });
https://github.com/amdjs/amdjs-api/wiki/require
CommonJS规范
var a = require("./aaa"); var b = require("./bbb"); module.exports = { result: a + b }
ES6 module
import a form "./aaa"; import b form "./bbb"; var c = a + b; export {c}
附:AMD规范 https://github.com/amdjs/amdjs-api/wiki/AMD
CommonJS规范 http://javascript.ruanyifeng.com/nodejs/module.html
文章来源: 前端模块化