4 ms·
I stopped using Bun, because it provides a nice API and just works and all, but it seems to be just a thin wrapper over Node, hiding the messy stuff underneath.
by prmph 2y ago
I stopped using Bun, because it provides a nice API and just works and all, but it seems to be just a thin wrapper over Node, hiding the messy stuff underneath.
I got some problems and it started leaking Node diagnostic messages all over the place. Was not impressed with how easily the facade fell over when I tried to do things just a little bit different from the happy path.
- 698969 2y agoI'm guessing this was from a time when they invoking bun on a script was just an alias to run it with node instead, and you had to do a more specific incantation like `bun run index.ts` to actually use the bun runtime. When did you use it?
- prmph 2y agoThis is probably what happened; it was like almost 2 years ago. Thanks for the explanation I do think it's a gotcha to run a script with another runtime than the one I launched from the terminal, though. If I launch a script directly with a runtime, I expect it to disregard any shebangs.
- mst 2y agobun is a completely separate piece of code - it uses JavaScriptCore rather than v8, there's no 'wrapper' involved. I strongly suspect that what you saw was from running a script with a #! line that specifies node, because bun honours #! lines by default. If you use <bun run --bun> that will tell it to use bun instead when it sees a node shebang.
- prmph 2y agoThis was probably it. Thanks.
- Jarred 2y agoBun does not wrap Node. Bun is a JavaScript runtime and suite of tools separate from Node. We do implement Node APIs and spend an enormous amount of time on compatibility. We have to use the same `code` property on many errors or libraries that rely on it break. It’s also possible you ran a package.json script that had the #!/usr/bin/env node shebang at the top, which Bun by default respects. You can force it to use bun by prefixing the command with “--bun”, like “bun --bun my-executable” What error did you run into?
- prmph 2y agoThis was probably it. Thanks. I think it's a gotcha to run a script with another runtime than the one I launched from the terminal, though. If I launch a script directly with a runtime, I expect it to disregard any shebangs.
- slmjkdbtl 2y agoIt takes less than the time to write this comment to check the code and see Bun is not a wrapper over Node
- prmph 2y agoGood to hear. I did not have time to go inspecting the code, with all the shiny tools that scream for me to try them, only to fall over. I think it's a gotcha to run a script with another runtime than the one I launched from the terminal, though. But I really want to have explore alternatives to Noe, so I will give Bun a new look soon.