(TypeScript developers might want to look away now…)
(So in case you’re wondering the resolved datatype is a proxy to the datatype. Previously, I was returning this from the synchronous constructor but since dynamic imports are asynchronous, my constructor needs to be also now. And when the promise tries to resolve, that’s when Node throws its exception. Fun times!) :)
(TypeScript developers might want to look away now…)
Hmm, no, it’s not that. Just created a basic spike to test just that and ESM is perfectly happy if you return a promise from a constructor that eventually resolves to a different datatype. So it must be something else that’s triggering it. With the stack traces were more helpful.