Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Capitalize global module names in UMD builds #17265

Closed
skrivle opened this issue Aug 24, 2015 · 3 comments
Closed

Capitalize global module names in UMD builds #17265

skrivle opened this issue Aug 24, 2015 · 3 comments
Labels

Comments

@skrivle
Copy link

skrivle commented Aug 24, 2015

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 ...

@fat
Copy link
Member

fat commented Nov 15, 2015

oh interesting, yeah i like that - a pr would be dope

@skrivle
Copy link
Author

skrivle commented Nov 22, 2015

Done!

@bardiharborow
Copy link
Member

bardiharborow commented Oct 28, 2016

I believe this is no longer valid now that we have removed the UMD builds.

@mdo mdo closed this as completed Nov 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants