You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just ran into an issue where the "modules" global declared by QUnit (which apparently complies with CommonJS) causes PubSub to think a module loading framework is present and take itself out of the global namespace, causing some of my stuff to break.
I've updated PubSubJS in a branch with more specific detection of CommonJS environments.
Could you get it from the branch and verify that it solves the QUnit conflict for you?
Hi All,
I just ran into an issue where the "modules" global declared by QUnit (which apparently complies with CommonJS) causes PubSub to think a module loading framework is present and take itself out of the global namespace, causing some of my stuff to break.
See this discussion on the QUnit site:
qunitjs/qunit#190
I notice that KnockoutJS uses the following logic for detecting a module loader:
function(factory) {
// Support three module loading scenarios
if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') {
// [1] CommonJS/Node.js
var target = module['exports'] || exports; // module.exports is for Node.js
factory(target);
} else if (typeof define === 'function' && define['amd']) {
// [2] AMD anonymous module
define(['exports'], factory);
} else {
// [3] No module loader (plain <script> tag) - put directly in global namespace
factory(window['ko'] = {});
}
}
Could someone modify the detection code in PubSub accordingly? Much appreciated (I'll have to do this locally in the meantime).
Cheers, Andrew.
The text was updated successfully, but these errors were encountered: