This would be beneficial because it tends to pollute globals even when it is unncessary.
The possible case is Angular module, e.g.
(function(__root, __factory) {
if (typeof define === "function" && define.amd) {
define("module-name", ["angular"], __factory);
} else if (typeof exports === "object") {
module.exports = __factory(require("angular"));
} else {
__root["module-name"] = __factory(angular);}
})(this, (function(__small$_mod_0) {
var exports = {};
...
exports = "moduleName";
return exports;
}))
The wide-spread convention for modular Angular workflow is
angular.module('appName', [require('module-name')]);
// instead of
// require('module-name');
// angular.module('appName', ['moduleName']);
So exported string is used only in the context of require or import, and __root["module-name"] = could be safely omitted if exportPackage.standalone === ''.
The checks for exportPackage.amd and exportPackage.commonjs could be added for consistency as well, but I see no possible use for that.
Can we do that?
This would be beneficial because it tends to pollute globals even when it is unncessary.
The possible case is Angular module, e.g.
The wide-spread convention for modular Angular workflow is
So exported string is used only in the context of
requireorimport, and__root["module-name"] =could be safely omitted ifexportPackage.standalone === ''.The checks for
exportPackage.amdandexportPackage.commonjscould be added for consistency as well, but I see no possible use for that.Can we do that?