是否有一种方法可以创建一个javascript微库(一个没有依赖项的库),该库支持以下所有模块格式:
发布于 2012-12-02 21:31:39
我怀疑你要找的就是他们所谓的"commonjsStrict.js“
发布于 2012-12-25 20:02:26
是的,我要感谢德德和他那令人敬畏的模块:
(function(name, definition) {
if (typeof module != 'undefined') module.exports = definition();
else if (typeof define == 'function' && typeof define.amd == 'object') define(definition);
else this[name] = definition();
}('mod', function() {
//This is the code you would normally have inside define() or add to module.exports
return {
sayHi: function(name) {
console.log('Hi ' + name + '!');
}
};
}));然后可以使用这一方法:
这种方法需要得到更多的宣传-如果jQuery和合作。开始使用它,生活会容易得多!
发布于 2013-10-02 10:12:51
uRequire,通用模块和资源转换器就是这样做的工具。
noConflict()。https://stackoverflow.com/questions/13673346
复制相似问题