我有一些模块,像这样的加载定义无依赖到现在为止还挺好。当它们通过绝对路径
但是,当我试图require
同一模块的绝对路径,我有我的依赖模块未定义:
require(["http://example.com/js/hello.js"],
function(hello)
{
console.log("main",hello);
hello.say("main");
});
控制台:
main undefined
Uncaught TypeError: Cannot read property 'say' of undefined // Oops!
为什么会这样呢?
谢谢您的全面回答 – 2014-10-20 16:34:21