Uncaught Error: Load timeout for modules: order!libs/jquery/jquery-min order!libs/underscore/underscore-min order!libs/parse/parse-min libs/jquery/jquery-min libs/underscore/underscore-min libs/parse/parse-min Backbone http://requirejs.org/docs/errors.html#timeout
I have no 404 requests under the Network tab of Chrome, and I have no script errors, so I am outside of the common bugs/fixes for the problem (according to requirejs.org).
When I look at my Network, I see that the scripts are loaded in the following order:
require.js
main.js
app.js <-- required by main.js
order.js <-- used in main.js to require the next 4 scripts (which aren't AMD)
jquery-min.js <-- required by main.js
underscore-min.js <-- required by main.js
backbone-min.js <-- required by main.js
parse-min.js <-- required by main.js
router.js
login.js
text.js
This seems right to me. Below is my code for main.js,app.js, and router.js.
main.js:
// Author: Thomas Davis <[email protected]>
// Filename: main.js
// Require.js allows us to configure shortcut alias
// Their usage will become more apparent futher along in the tutorial.
require.config( {
paths : {
jQuery : 'libs/jquery/jquery-min',
Underscore : 'libs/underscore/underscore-min',
Backbone : 'libs/backbone/backbone-min',
Parse : 'libs/parse/parse-min',
templates : '../templates'
}
});
require( [
// Load our app module and pass it to our definition function
'app',
// Some plugins have to be loaded in order due to their non AMD compliance
// Because these scripts are not "modules" they do not pass any values to the
// definition function below
'order!libs/jquery/jquery-min',
'order!libs/underscore/underscore-min',
'order!libs/backbone/backbone-min',
'order!libs/parse/parse-min'
],
function(App) {
// The "app" dependency is passed in as "App"
// Again, the other dependencies passed in are not "AMD" therefore
// don't pass a parameter to this function
App.initialize();
});
app.js:
// Filename: app.js
define( [ 'jQuery', 'Underscore', 'Parse', 'router' ],
function($, _, Parse, Router) {
var initialize = function() {
Parse.$ = $;
// Initialize Parse with your Parse application javascript keys
Parse.initialize("HIDDEN", "ALSO HIDDEN");
// Pass in our Router module and call it's initialize function
Router.initialize();
};
return {
initialize : initialize
};
});
router.js:
// Filename: router.js
define( [ 'jQuery', 'Underscore', 'Backbone', 'Parse', 'views/home/login', ],
function($, _, Backbone, Parse, loginView) {
var AppRouter = Backbone.Router.extend( {
routes : {
// Default
'*actions' : 'defaultAction'
},
defaultAction : function(actions) {
// We have no matching route, lets display the home page
loginView.render();
}
});
var initialize = function() {
var app_router = new AppRouter;
Backbone.history.start();
};
return {
initialize : initialize
};
});