源码解析
(function (root, factory) {
// 判断是否支持AMD(define是否存在)
if (typeof define === 'function' && define.amd) {
define(['b'], factory)
// 判断是否支持NodeJS模块格式(exports是否存在)
} else if (typeof module === 'object' && module.exports) {
module.exports = factory(require('b'))
// 前两个都不存在,则将模块公开到全局(window或global)
} else {
root.returnExports = factory(root.b)
}
})(this, function (b) {
...
}))