I need to include a bootstrap carousel via requirejs, the problem is that it fails to load pooper.js
Error :
Failed to load for element whose source is "https://domaine.com/popper.js".
My code:
requirejs-config.js
var config = {
deps: [
'js/theme'
],
paths: {
'popper': 'js/bootstrap4/popper.min',
'bootstrap4': 'js/bootstrap4/bootstrap.min'
},
shim: {
'popper': {
'deps': ['jquery'],
'exports': 'Popper'
},
'bootstrap4': {
'deps': ['jquery', 'popper']
}
}
};
js/theme.js
require(['jquery', 'popper'], function(jQuery, Popper) {
window.Popper = Popper; // re-attach to global scope
require(['bootstrap4'], function() {
jQuery(function() {
//needed (even if empty) to force RequireJS to load Bootstrap
// We can calls to bootstrap functions here.
alert('hey');
});
});
});
I think that the problem comes from require(['bootstrap4'], function() {
line when I comment this line I have my alert, but also the carousel doesn't work, without commenting it I have the error : Failed to load for element whose source is "https://domaine.com/popper.js".