0

如果我在我的 domain.com/seeker/job 页面加载

<script type="text/javascript" src="{{ asset('assets/backbone/js/libs/require/require.js')}}"></script>
<script type="text/javascript" src="{{ asset('assets/backbone/main.js')}}"></script>

main.js 文件

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

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

错误

GET http://domain.com/manipulation/_evalUrl.js 500 (Internal Server Error) require.js:1881
Uncaught Error: Script error for: manipulation/_evalUrl
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET http://domain.com/ajax.js 500 (Internal Server Error) require.js:1881
Uncaught Error: Script error for: ajax
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET http://domain.com/serialize.js 500 (Internal Server Error) require.js:1881
Uncaught Error: Script error for: serialize
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET http://domain.com/ajax/jsonp.js 500 (Internal Server Error) require.js:1881
Uncaught Error: Script error for: ajax/jsonp
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET http://domain.com/ajax/xhr.js 500 (Internal Server Error) require.js:1881
Uncaught Error: Script error for: ajax/xhr
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET http://domain.com/ajax/script.js 500 (Internal Server Error) require.js:1881
Uncaught Error: Script error for: ajax/script
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET http://domain.com/ajax/load.js 500 (Internal Server Error) require.js:1881
Uncaught Error: Script error for: ajax/load
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET http://domain.com/effects.js 500 (Internal Server Error) require.js:1881
Uncaught Error: Script error for: effects
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET http://domain.com/effects/animatedSelector.js 500 (Internal Server Error) require.js:1881
Uncaught Error: Script error for: effects/animatedSelector
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET http://domain.com/dimensions.js 500 (Internal Server Error) require.js:1881
Uncaught Error: Script error for: dimensions
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET http://domain.com/exports/amd.js 500 (Internal Server Error) require.js:1881
Uncaught Error: Script error for: exports/amd
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET http://domain.com/deprecated.js 500 (Internal Server Error) require.js:1881
Uncaught Error: Script error for: deprecated
http://requirejs.org/docs/errors.html#scripterror require.js:163
GET http://domain.com/offset.js 500 (Internal Server Error) require.js:1881
Uncaught Error: Script error for: offset
http://requirejs.org/docs/errors.html#scripterror require.js:163
Uncaught Error: Load timeout for modules: 
http://requirejs.org/docs/errors.html#timeout 

错误列表很长,它表现得好像找不到 URL 并且正在加载基本 URL?我做错了什么?

4

2 回答 2

1

如果您尝试将其/templates作为 URL 的第一部分,请尝试设置 baseUrl。默认情况下,它会./解析到您的/seeker目录。

require.config({
    baseUrl: "/",
    paths:{
        "jquery": "js/libs/jquery/src/jquery",
        "underscore": "js/libs/underscore/underscore",
        "backbone": "js/libs/backbone/backbone"
    },
    waitSeconds: 7
});
于 2013-11-15T02:17:46.603 回答
0

看到这个一年的帖子,我也有同样的问题。

您尝试提取的 jquery 文件不是来自“src”文件夹,而是来自“dist”。

因此,在您的 main.js 文件中,将一行更改为

"jquery": "domain.com/js/libs/jquery/dist/jquery"
于 2015-02-08T15:33:54.487 回答