I am trying to load BootstrapDialog http://nakupanda.github.io/bootstrap3-dialog/ with requireJS but so far I am unsuccessful as it is always null.
This is my current configuration:
//main.js
require.config({
paths: {
jquery: '/js/libs/jquery/jquery.min',
underscore: '/js/libs/underscore/underscore.min',
backbone: '/js/libs/backbone/backbone-min',
bootstrap: '/js/libs/bootstrap/bootstrap.min',
bootstrapDialog: '/js/libs/bootstrap/bootstrap-dialog.min'
},
shim: {
bootstrap: {
deps: ["jquery"]
},
bootstrapDialog: {
deps: ["jquery", "underscore","backbone", "bootstrap"]
}
}
});
And a module example:
define([
'jquery',
'underscore',
'backbone',
'bootstrapDialog',
], function($, _, Backbone, BootstrapDialog){
console.log("New bootstrap dialog");
console.log(BootstrapDialog); //BootstrapDialog is always null
});
How can I intergrate BootStrapDialog with requireJs ?
BootstrapDialog registers itself with the name bootstrap-dialog
, see line 871:
define("bootstrap-dialog", function() {
return BootstrapDialog;
});
So you just need to replace bootstrapDialog
with 'bootstrap-dialog'
in your config.
Plunker.