points
1 year ago
| 1 comment
| HN
I actually used Bun for the first time the other day and it was an amazing experience. All my projects have Webpack or Vite configured to let me write Typescript and once setup they work almost flawlessly but it’s a pain to set it all and not worth it for small scripts.

On the other hand Bun worked right out of the box. I had spent 10-30 minutes futzing around with node-ts or whatever the tool is to run TS “directly” on the CLI and I was dealing with the all the dreaded messages “not a module”, “can’t use import/require”, “ESM/CJS” and trying all the normal fixes (changing package.json module type, changing tsconfig, changing the way import/require) all to get a ~200 line script to run. I switched to Bun as a Hail Mary and it worked wonderfully.

graynk
1 year ago
[-]
Latest node.js now supports „just running ts“ for cases like these:

node --experimental-strip-types index.ts

On non-latest Node tsx package worked great for me (as oppposed to ts-node)

But both of those options just throw away type information (and so does Bun)

reply