Hacker News new | ask | show | jobs
by chromakode 840 days ago
I got thoroughly frustrated with Deno on a side project for similar reasons (leaky node compat abstractions, kludgey interop between code that does IO the Deno way and Node modules, immature Deno stdlib, undermaintained Deno libraries, spooky bugs). I lost a lot of time to figuring out how to make things work the Deno way.

Then I spent a day switching my codebase back to Node. I was struck by how much worse my code got. The Deno code made use of niceties like top level await and import maps. I needed to resort to a bundler to dedup instances of Y.js between my backend and Lexical. The Deno libraries tended have cleaner APIs (e.g. Oak vs. Koa).

After I took a step back, I scrapped the Node rework and accepted my misgivings with Deno, for now. Going back to Node was kind of like playing an older game; the graphics were great at the time but now that I've seen what a 2023 backend Typescript codebase looks like, I don't want to go back.

2 comments

Heh I had the same experience but with bun. Lots of subtle bugs on stream and crypto packages where I spent a lot of time trying to figure out what was wrong only to find that it's a known bug in bun. I would have understood that there'd be bugs in relatively new runtime that's undertaking this huge task but it's not drop-in replacement for node as it claims to be and I wouldn't say v1 is stable at all.
That highlights a different difference. There aren't that many bugs in Deno; there's a lot of missing functionality (especially if you have node/npm-colored glasses on), but Deno is pretty much the highest quality "full Javascript runtime" when NodeJS compatibility is not a requirement.

Bun seems to be.. essentially a rewrite of NodeJS with the same basic plan.

Node has native top level await. However, figuring out how to make it work is an exercise in frustration for many.
Yep! 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.
Is 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?
npm install -g tsx

Name your files .ts and run with tsx ./file.ts

All done, good to go

I just use npx vite-node or bun to run TS directly