KnockoutJS has (I think) an unusual way to register its self under AMD... its code looks like this (ref here):
// 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, require);
} else if (typeof define === 'function' && define['amd']) {
// [2] AMD anonymous module
define(['exports', 'require'], factory);
} else {
// [3] No module loader (plain <script> tag) - put directly in global namespace
factory(window['ko'] = {});
}
amdclean converts this to:
// 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, require);
} else if (true) {
knockout = function (exports, require) {
return typeof factory === 'function' ? factory(exports, require) : factory;
}({}, {});
} else {
// [3] No module loader (plain <script> tag) - put directly in global namespace
factory(window['ko'] = {});
}
This however, does not register the module because the knockoutjs factory does not return anything - it simply adds its methods to the exports provided on input
Anyway I can fix this during the build process? or get around it?
KnockoutJS has (I think) an unusual way to register its self under AMD... its code looks like this (ref here):
amdclean converts this to:
This however, does not register the module because the knockoutjs factory does not return anything - it simply adds its methods to the
exports
provided on inputAnyway I can fix this during the build process? or get around it?
Thanks in advance.
/Paul.