Re:Node Modules at War: Why CommonJS and ES Modules Can’t Ge...
by jcheng on Thursday August 06, 2020 @01:00PM
(#24072901)
For those who, like me, wondered how this is possible without hitting the top-level await obstacle mentioned in the article, the options doc includes this line (emphasis mine):
> "await":false - A boolean for top-level await in modules without ESM exports. (Node 10+)
So, yeah, seems to rely on "most ESM modules don't use top-level await". Seems like a useful option to have, thanks!
Re:Node Modules at War: Why CommonJS and ES Modules Can’t Ge...
by jkrems on Thursday August 06, 2020 @01:27PM
(#24073211)
Another similar option is `@babel/cli` which also allows using module syntax with require-like semantics. It's a bit more widely supported in other tools which can be an advantage.
Re:Node Modules at War: Why CommonJS and ES Modules Can’t Ge...
by chrisweekly on Thursday August 06, 2020 @11:26AM
(#24071773)
How did this escape my attention till now? Thanks for the link! :)
https://www.npmjs.com/package/esm
I highly recommend it. Really let’s you unify on ESM modules without much thought