Reputation: 2642
I searched some questions in here, but didn't get any solution. I'm trying to use datepicker
in backbone.js
require.js
project.
main.js
:
requirejs.config({
enforceDefine: true,
paths: {
"jquery": "libs/jquery/jquery-min",
"underscore": "libs/underscore/underscore",
"backbone": "libs/backbone/backbone-min",
"jquery-ui" : "libs/jquery/jquery-ui"
},
shim : {
"underscore": {
deps: [],
exports: "_"
},
"backbone": {
deps: ["jquery", "underscore"],
exports: "Backbone"
},
"jquery-ui" : ['jquery']
}
});
Here is my view :
define(["jquery","underscore","backbone","jquery-ui"], ,function($, _, Backbone,jqueryUI){
//view code block
});
Just define it like this, and not yet call any function of jquery-ui
then I got one error in my console Error: No define call for jquery-ui http://requirejs.org docs/errors.html#nodefine
.
Any help would be appreciated.
Upvotes: 1
Views: 1377
Reputation: 1643
as for jquery plugin, I prefer to convert to UMD module which is much cleaner way to avoid contamination of global variable
Upvotes: 0