I have a module defined as follows:
define(
['backbone', 'View/Sidebar', 'View/ControlBar'],
function() {
...
}
);
In that module there is a method called loadView, which assigns a variable as follows:
loadView: function(name, bootstrap_function, into) {
var _class = require('View/'+name);
...
}
So, we can see that both View/Sidebar and View/ControlBar are being loaded by the define call (first arg). When I use require('Sidebar'), I get no errors, yet if I use require('ControlBar') I do get the notorious:
Error: Module name "View/ControlBar" has not been loaded yet for context: _
(http://requirejs.org/docs/errors.html#notloaded)
I have re-written, copied and pasted, verified that it is loaded in Firebug and so on but cannot for the life of me work out why I am getting this error 100% of the time.
I think this has something to do with how the arguments are called for require. I have found that the following throws an error
Whereas the following does not:
The difference is whether or not the loaded modules are declared as arguments to the function or not. At least this is the way that it seems to me, it does not, however, make much sense…