Actually I'm facing an irritating problem with Requirejs and Backbone. I'm developing my App on two different paths:
- the main access, for example: /App/index.php#list
- the sub access, for example: /App/index.php/clone#list
The problem appear when I need to load a module with the method require([module]).
If I use the absolute path, like require(['/App/js/views/modal.js']) I just obtain this error:
Error: Load timeout for modules: /App/js/views/modal.js
If I use a relative way, like require(['js/views/modal.js']) on my main access and require(['../js/views/modal.js']) on my sub access, everything work as expected.
I'm loading other modules with the absolute path and they work, if I duplicate the module and require it with a different name it works, I tink the only difference is that the module I'm requiring has already been definited in another module and so it has already been loaded, like this:
Main module
require('/App/js/views/row.js'], function(Row){
Somecode...
});
....
require('/App/js/views/modal.js'], function(Modal){
Othercode...
});
Row Module
define([
'backbone',
'text!templates/row.html',
'views/modal', //the same view callend in my main file!
], function(Backbone, rowTemplate, Modal){
Viewcode...
});
Modal Module
define([
'backbone',
'text!templates/modal.html',
'models/user_model',
], function(Backbone, modalTemplate, Model){
Viewcode...
});
Maybe I'm missing something but I don't get the logic behind this, why isn't working with the absolute address?