Reputation: 15293
I am using require.js, all are correct as well. I see the js loads in the document. In case of consoling, I am getting all of the parameters apart from Backbone. Why is the Backbone not logged in the console?
Here is my code :
requirejs.config({
baseUrl : "scripts",
paths : {
"jquery" :"lib/jquery-min",
"loDash" :"lib/lodash-min",
"backBone" :"lib/backbone-min"
//this is exist load in document header, not console
}
});
require(["jquery","loDash","backBone"], function($,_,bB){
console.log($,_,bB);//jquery, underscore console correctly.
// 3rd one "bB" - stand for backbone, it console as undefined - why?
});
I am getting loaded all the js fine, including Backbone, on the document.
Upvotes: 2
Views: 87
Reputation: 15293
I added the shim, and it works fine.
requirejs.config({
baseUrl : "scripts",
paths : {
"jquery" :"lib/jquery-min",
"loDash" :"lib/lodash-min",
"backBone" :"lib/backbone-min"
},
shim : {
"backBone":{
deps :["loDash"],
exports :"Backbone"
}
}
});
require(["jquery","loDash","backBone"], function ($,_,bB) {
console.log($,_,bB);
});
Upvotes: 1