I have a UMD library and the following works in commonjs...
global.window = global;
var DoSomething = require("../dist/sce-umd.js").DoSomething;
(function(){
var instance = new DoSomething();
instance.doSomethingElse();
})()
I am trying to do the same thing with ESM like...
(()=>{
// Needed for UMD
global.window = global;
import("../dist/sce-umd.js").then((OtherThing)=>{
console.log("This is the next level");
const other = new OtherThing();
other.doSomethingElse();
});
})();
But I get...
TypeError: OtherThing is not a constructor
I also tried new OtherThing.DoSomething()
but I get...
TypeError: OtherThing.DoSomething is not a constructor