Config文件中的RequireJS问题

时间:2013-11-15 02:47:02

标签: javascript php backbone.js requirejs

require.config({
   baseUrl: "/",
   paths:{
       "jquery": "/assets/backbone/assets/backbone/js/libs/jquery/src/jquery",
       "underscore": "/assets/backbone/js/libs/underscore/underscore",
       "backbone": "/assets/backbone/js/libs/backbone/backbone"
   }
});

require(['assets/backbone/templates/views/app'], function(AppView){
    new AppView;
});

错误

GET http://domain.com/assets/backbone/assets/backbone/js/libs/jquery/src/jquery.js 500 (Internal Server Error) 

如果我从assets / backbone / templates / views / app

中删除assets / backbone /
GET http://domain.com/templates/views/app 500 (Internal Server Error) require.js:1881
Uncaught Error: Script error for: /templates/views/app

.....为什么要复制两次或根本不显示?

1 个答案:

答案 0 :(得分:0)

我对你的jquery的路径是错误的。

require.config({
   baseUrl: "/",
   paths:{
       // probably this line is wrong
       // "jquery": "/assets/backbone/assets/backbone/js/libs/jquery/src/jquery",
       "jquery": "/assets/backbone/js/libs/jquery/src/jquery",
       "underscore": "/assets/backbone/js/libs/underscore/underscore",
       "backbone": "/assets/backbone/js/libs/backbone/backbone"
   }
});