Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RequireJS and text plugin Load timeout for modules

I am having some problems getting the RequireJS text plugin to work. This is possibly a path related issue (or something similarly obvious) but I can't solve it because neither the chrome console (with xhr turned on) nor firebug is giving me any info other than

Uncaught Error: Load timeout for modules: text 
http://requirejs.org/docs/errors.html#timeout

I am quite sure that the paths are OK but I cant find any other explanation. Does somebody have an idea how to debug this?

I am using node.js and express on the server side and backbone and jQuery on the client end. All of these get loaded correctly with RequireJS.

like image 820
Johannes Degn Avatar asked Dec 20 '11 21:12

Johannes Degn


1 Answers

I'm guessing it's a path issue. I have the same setup (node/express and backbone) and it seems to be working for me. Here is my main.js file:

require.config({
  paths: {
    jquery: 'libs/jquery-1.7.1.min',
    underscore: 'libs/underscore',
    backbone: 'libs/backbone',
    text: 'libs/text',
    templates: '../views',
    persist: 'libs/persist/persist'
  }
});
require([
  'app'
], function(App){
  App.initialize();
});

and here is how I call the plugin from within a module:

define([
  'jquery',
  'underscore',
  'backbone',
  'collections/sub_elements',
  'collections/elements',
  'views/element',
  'text!../../../views/partials/_elements.html'
], function($, _, Backbone, sub_elementsCollection, collection, view,     template){

  var elementsView = Backbone.View.extend({
    // ... //
  });

  return elementsView;
});
like image 129
swatkins Avatar answered Sep 20 '22 03:09

swatkins