Reputation: 5948
Hi I recently changed my App to requireJS structure, and i modified all 3rd party libraries to the shim configuration. But when i run the integration tests i have in my App i got some failures like.
requirejs.config({
baseUrl: 'resources/js/lib/',
shim : {
'bootstrap' : {deps: ['jquery']},
'bootstrap-datepicker': { deps: ['jquery', 'bootstrap']},
...
},
paths: {
'app': '../app',
'jquery': 'jquery-1.11.1',
'bootstrap' : 'bootstrap',
'bootstrap-datepicker': 'bootstrap-datepicker',
...
}
});
but i got this failures
$(...).collapse() its not a function.
$(...).datepicker() its not a function.
I figure out the problem its with the libraries that are not AMD compatible as (bootstrap.js, bootstrap-datepicker.js, chosen.js,...)
There are some way to solve this problem with requireJS and non AMD libraries?
Thanks
Upvotes: 1
Views: 232
Reputation: 5948
I found a solution and i hope this can help everybody with the same problem.
You need to use properly the requirejs.config and add all related dependencies of yours shim libraries. No need to use exports functionallity.
IMPORTANT be sure to use all 3rd party libraries with AMD compatible
Upvotes: 1