Hello,
I try to import an anonymous AMD module : Bootbox.js.
I read Ember CLI User manual how to import it :
app.import('bower_components/bootbox/bootbox.js', {
using: [
{ transformation: 'amd', as: 'bootbox' }
]
});
It’s OK.
BUT, when i try to use it, i have an error: $.extend is not a function
$
(jQuery) is not well defined! In Bootbox.js code, I added a console.log
to display $
value:
(function (root, factory) {
"use strict";
if (typeof define === "function" && define.amd) {
// AMD. Register as an anonymous module.
define(["jquery"], factory);
} else if (typeof exports === "object") {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory(require("jquery"));
} else {
// Browser globals (root is window)
root.bootbox = factory(root.jQuery);
}
}(this, function init($, undefined) {
"use strict";
console.log($);
... code code code ...
$
is an JS object with a default
property that is jQuery:
{
__esModule: true,
default: function ( selector, context ),
__proto__: Object
}
BUT Bootbox.js uses $.extend
in its code and not $.default.extend
…
Could someone help me to understand this and to configure/import this module? Thank you,