3 ms·
Node has native top level await. However, figuring out how to make it work is an exercise in frustration for many.
by moltar 3y ago
Node has native top level await. However, figuring out how to make it work is an exercise in frustration for many.
- throwaway11460 3y agonpm install -g tsx Name your files .ts and run with tsx ./file.ts All done, good to go
- FractalHQ 3y agoI just use npx vite-node or bun to run TS directly
- tehbeard 3y agoIs it much the same as trying to use esm in node while having legacy CJS code? Several options that end up with weird tradeoffs and bugs?
- chromakode 3y agoYep! It requires ESM, which had other knock on effects in my codebase, IIRC with Lexical. I needed to hack around this a bit for Deno's module system as well (using esm.sh to preprocess Lexical) but it was a much nicer DX.