我的項目:
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未找到 - 本地主機/ JS/main.js」
和
2)錯誤:腳本錯誤http://requirejs.org/docs/errors.html#scripterror
沒有人知道最新錯了嗎?
main.js不在你的js文件夾內。刪除baseUrl – ashley
這不是一個奇怪的錯誤,它只是無法加載文件..是在js文件夾內的main.js? – andygoestohollywood
@andygoestohollywood是的,main.js是在js文件夾中 – SHT