by Scooty · 7y ago · 0 comments
To me this is most important in node where it's not uncommon to do async operations during initialization. Currently you either have to export a promise or an async function.
Is the argument for top-level await that you don't need the other spot? Because I feel like you still do - except now it's implicitly inside not only A, but likely B and C as well to some extent. And in a very inflexible way.
Synchronous effectful imports are already are the source of so much frustration, and now we're adding asynchronicity to it?
Just export a init function and let your users choose when/where to run your effectful initialization code, sync or async.