dfilatov / vow

ES6-compatible and Promises/A+ implementation for Node.js and browsers
MIT License
344 stars 45 forks source link

Failing when grunt-traceur-build is installed #82

Closed jirihelmich closed 9 years ago

jirihelmich commented 9 years ago
if(typeof modules === 'object') {
    modules.define('vow', function(provide) {
        provide(vow);
    });
    defineAsGlobal = false;
}

modules is object, but it does not have function define

dfilatov commented 9 years ago

modules is object from https://github.com/ymaps/modules What's modules which provides grunt-traceur-build to the global scope?

jirihelmich commented 9 years ago

seems like

{
  standardModuleUrlRegExp: [Getter],
  getModuleInstanceByUrl: [Getter],
  getCurrentCodeUnit: [Getter],
  setCurrentCodeUnit: [Getter]
}

https://code.google.com/p/traceur-compiler/source/browse/src/runtime/get-module.js?spec=svn61b1b08180bee0916869cdb0e43561a604f8323d&r=61b1b08180bee0916869cdb0e43561a604f8323d

It is definitely not a good practice to export such a global variable, but I don't expect Google to change it.

However

if(typeof modules === 'object' && 'define' in modules && typeof(modules.define) === 'function') {
    modules.define('vow', function(provide) {
        provide(vow);
    });
    defineAsGlobal = false;
}

doesn't break your integration with ymaps/modules and works when people use traceur.

dfilatov commented 9 years ago

Ok, I'll fix it as soon as possible Thanks for report!

jirihelmich commented 9 years ago

:+1: thanks!

dfilatov commented 9 years ago

fixed in 0.4.8