Capitalize global module names in UMD builds
Created by: skrivle
It seems that babel by default is lowercasing all module names, which is causing errors when trying to use the UMD builds in global environment.
Popover.js is requiring global.Tooltip
(function (global, factory) {
if (typeof define === 'function' && define.amd) {
define('Popover', ['exports', 'module', './tooltip'], factory);
} else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
factory(exports, module, require('./tooltip'));
} else {
var mod = {
exports: {}
};
factory(mod.exports, mod, global.Tooltip);
global.Popover = mod.exports;
}
})(this, function (exports, module, _tooltip) { ... });
But tooltip.js is only defining global.tooltip ...
(function (global, factory) {
if (typeof define === 'function' && define.amd) {
define('Tooltip', ['exports', 'module', './util'], factory);
} else if (typeof exports !== 'undefined' && typeof module !== 'undefined') {
factory(exports, module, require('./util'));
} else {
var mod = {
exports: {}
};
factory(mod.exports, mod, global.Util);
global.tooltip = mod.exports;
}
})(this, function (exports, module, _util) { ... });
This is fixable by leveraging the getModuleId option in the grunt babel:umd configuration as you can see here. If you want I can open a pull request ...