http://requirejs.org/RequireJS插件(order.js)
我最近下載require.js 2.0,我在我的控制檯收到錯誤:
Uncaught TypeError: Object function(){var g=ga.call(arguments,0),e;if(f&&v(e=g[g.length-1]))e.__requireJsBuild=!0;g.push(d);return b.apply(null,g)} has no method 'nameToUrl'
是order.js插件仍然requirejs支持?我沒有在網站上看到它的文檔。
當我嘗試刪除文件腳本中斷。
在我的索引文件,我包括在頭部分requirejs腳本:
<!DOCTYPE html>
<html>
<head>
<title>
My Mobile Application
</title>
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0/jquery.mobile-1.1.0.min.css" />
<link rel="stylesheet" href="public/css/style.css" />
<script data-main="scripts/main.js" src="scripts/require.js"></script>
</head>
<body></body>
</html>
然後在我main.js文件:
requirejs.config({
//By default load any module IDs from js/lib
baseUrl: 'js/lib',
//except, if the module ID starts with "app",
//load it from the js/app directory. paths
//config is relative to the baseUrl, and
//never includes a ".js" extension since
//the paths config could be for a directory.
paths: {
app: '../app',
assets: '../assets',
views: '../app/views',
templates: '../app/templates',
collections: '../app/collections',
models: '../app/models'
}
});
// Start the main app logic.
requirejs([
'jquery/jquery',
'assets/jqm.config',
'jquery/mobile',
'text'
]);
require([
'app'
],
function(App){
$(document).ready(function(){
App.initialize();
});
}
);
我看到它,App.initialize沒有按」沒有任何錯誤,而App.initialize正在做的只是簡單的地理位置。 requirejs只是要求order.js,當我把代碼與上面提到的相同的錯誤。
謝謝!
[Stack Overflow不是心靈讀者](http://meta.stackexchange.com/a/128551/177538)。代碼是什麼? – Joseph
對不起。編輯。 :) –