0
我为它开发了一个应用程序和一些模块。 这个模块我包含了RequireJS,但是也想包含在另一个没有RequireJS支持的应用中。如何让RequireJS兼容库可以包含到其他JS?
我需要修改我的库文件,让它被包含在其他JS文件中(通过复制内容)?
所以我想图书馆有使用的两种方式:阅读UMD
requirejs(["helper/util"], function(util) {
// library loaded
window.MyUtilModule = util;
window.MyUtilModule.someFunc();
});
和
/* >> No RequreJS library load here << */
/* >> Code copied from 'helper/util.js' goes here << */
window.MyUtilModule.someFunc(); // already loaded by simple including code into another file