I'm trying to apply requireJS in my application, so I'm having some problems.
require-config.js
var require = {
paths: {
"jquery": "/admin/admin-v2/bower_components/jquery/dist/jquery.min",
"bootstrap": "/admin/admin-v2/bower_components/bootstrap/dist/js/bootstrap.min",
"metismenu": "/admin/admin-v2/bower_components/metisMenu/dist/metisMenu.min",
"morris": "/admin/admin-v2/bower_components/morrisjs/morris.min",
"raphael": "/admin/admin-v2/bower_components/raphael/raphael-min",
"morrisdata": "/admin/admin-v2/controllers/js/morris-data",
"datatables": "/admin/admin-v2/bower_components/datatables/media/js/jquery.dataTables.min",
"datatablesbootstrap": "/admin/admin-v2/bower_components/datatables-plugins/integration/bootstrap/3/dataTables.bootstrap.min",
"global": "/admin/admin-v2/js/sb-admin-2"
},
shim: {
'jquery': {
deps: [],
exports: '$'
},
'bootstrap': {
deps: ['jquery']
},
'metismenu': {
deps: ['jquery']
},
'raphael': {
deps: ['jquery'],
exports: 'Raphael'
},
'morris': {
deps: ['jquery', 'raphael'],
exports: 'Morris'
},
'morrisdata': {
deps: ['jquery', 'morris']
},
'datatables': {
deps: ['jquery']
},
'fatatablesbootstrap': {
deps: ['jquery', 'datatables', 'bootstrap']
},
'global': {
deps: ['jquery', 'metismenu']
}
}
};
This is my app.js:
require(['jquery', 'bootstrap', 'datatables', 'datatablesbootstrap', 'global'], function () {
$(function () {
//my code goes here
});
});
I'm getting this error in the chrome console: Uncaught Error: Bootstrap's JavaScript requires jQuery
I set jquery in the bootstrap dependencies so I do not understand what the problem is.
If I take all the depts and leave only the jquery in the call of the require it is recognized, but if I add any other dependencies it is no longer recognized.