有一些奇怪的加载错误,我不知道为什么:
我的项目:
index.php
js/
libs/
require.js
backbone.js
jquery.js
modernizr.js
lodash.js
selectivzr.js
..a lot more .js files
templates/
bunch of .html files...
views/
bunch of views...
config.js
main.js
我的config.js:
require.config({
deps: ["main"],
baseUrl: "/js",
paths: {
jquery: "/libs/jquery.min",
lodash: "/libs/lodash.min",
backbone: "/libs/backbone.min",
...a lot more
},
shim: {
backbone: {
deps: ["lodash", "jquery", "modernizr", etc etc],
exports: "backbone"
}
}
});
现在,当我尝试运行它时,我收到2条奇怪的错误消息:
1)“NetworkError:404 Not Found - localhost / js / main.js”
和
2)错误:脚本错误http://requirejs.org/docs/errors.html#scripterror
有谁知道什么是错的?
答案 0 :(得分:0)
/ js不在您的网络服务器的根目录..
所以:
baseUrl: "js/",