I'm not sure about using “export” in the shim configuration, following the example of the requireJS API, I can use the Backbone (B in capital letter) to export it to the global scope. This means that this will be a property of the window object. But I realized that I have to use this name, and I can’t export it with another link name, that is: "MyGlobalBackbone"
require.config({
paths: {
backboneAlias:'backbone'
},
shim : {
backboneAlias : {
deps : [ 'underscore', 'jquery-1.9.1' ],
exports : 'MyGlobalBackbone'
}
}
});
require(['backboneAlias'],function(backboneAsAliasDependency){
console.log(backboneAsAliasDependency);
console.log(MyGlobalBackbone);
});
This code only works if I use "Backbone" instead of "MyGlobalBackbone" ...
source
share