I'd like to use the select2 Javascript library. Unfortunately, they force the use of AMD on their users.
I'd like to use ES6 modules exclusively in my code. Is there a way for a ES6 module to export variables that are initialized asynchronously by AMD? For example, I'd like to do something like this:
const result = $.fn.select2.amd.require([
"select2/data/array",
"select2/utils"
], function (ArrayData, Utils)
{
return "something";
});
export {result as default};
That way, I can wrap the AMD ugliness is a single place and import it as ES6 everywhere else.