Webpack 生成以下 UMD 定义:
(function webpackUniversalModuleDefinition(root, factory) {
// this is CommonJS/Node
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
// this is AMD
else if(typeof define === 'function' && define.amd)
define([], factory);
// what is this environment or standard?
else if(typeof exports === 'object') <------------- ???
exports["rx-core-libs"] = factory();
// Window/Global
else
root["rx-core-libs"] = factory();
})
我的问题是这个标准或环境是做什么用的?
else if(typeof exports === 'object')
它类似于 CommonJS,但没有module
.