News for hackers. Stuff that matters.
Re:Using Bun.js as a Bundler by iainmerrick on Wednesday May 17, 2023 @07:11PM (#35982401)
It’ll take a lot to replace esbuild for me -- it’s fast enough that it’s never the bottleneck and more importantly has always been absolutely rock-solid and reliable. So a tool that’s 2x faster but less reliable isn’t appealing.
Re:Using Bun.js as a Bundler by throwme_123 on Wednesday May 17, 2023 @07:17PM (#35982443)
bun seems great and promising but I'm in the same boat. vite/esbuild with vitest is running perfectly, and already fast enough (and at last not struggling with webpack or rollup overall poor quality anymore...).
Re:Using Bun.js as a Bundler by iainmerrick on Wednesday May 17, 2023 @07:24PM (#35982496)
Yep, vite is really nice too.
Re:Using Bun.js as a Bundler by silverwind on Wednesday May 17, 2023 @07:47PM (#35982656)
bun can run vite prod build at least and seems about 10% faster at it than node according to my testing.
Re:Using Bun.js as a Bundler by eyelidlessness on Thursday May 18, 2023 @02:24AM (#35984652)
My problem with “Vite is good enough” and “Vitest is good enough” as a paired hypothesis is they are literally opposite in their target environments. It’s explicitly unsupported to use Vite to build projects specifically for Node as a target, and it’s explicitly unsupported to test in Vitest in browser environments (though I think that’s being actively addressed, but it’s still going to be a second class solution).
Re:Using Bun.js as a Bundler by throwme_123 on Friday May 19, 2023 @09:38AM (#36001789)
It depends of what you mean by browser environments (integration tests?), but vitest with happy-dom is working great for testing libraries and components.
Re:Using Bun.js as a Bundler by 8n4vidtmkvmk on Wednesday May 17, 2023 @10:00PM (#35983408)
I've had bad experiences with esbuild. Don't remember what specifically but didn't work for my use cases.

Roll-up for libs and webpack for apps. Only thing that works for me and all the wonky edge cases involved in building for web and node and npm and old browsers and various file types and loaders and whatnot.

Re:Using Bun.js as a Bundler by reilly3000 on Thursday May 18, 2023 @12:14AM (#35984061)
It isn’t clear to me that bun is less reliable. A day old bundling tool is not a fair yardstick for what I’m referring to. In general I haven’t heard about any reliability issues and see glowing reviews about its cold start time and thorough-put. If there are any I should be aware of please do share.
Re:Using Bun.js as a Bundler by iainmerrick on Thursday May 18, 2023 @01:35AM (#35984445)
I was just thinking about the sort of issues described in this post, like having to use specific flags to prevent the minifier breaking code, or write an extra pass to tweak the output. I’d worry about what other problems there might be that I hadn’t noticed yet.

Presumably those will get fixed over time, and at some point bun will just work if you want to replace your existing bundler. But even then, I personally would lean to sticking with esbuild as it’s more than fast enough for my purposes -- extra speed isn’t a compelling selling point (for me).

Re:Using Bun.js as a Bundler by shaneos on Thursday May 18, 2023 @02:48AM (#35984789)
Yes, Bun is very much in beta, but it's already really, really good. I'm fine using it with my hobby projects right now, but once it gets to 1.0 I'll give serious consideration to using it in production code too. The API is really simple, and I love how it just understands Typescript, so you can throw any code in your repo at it and it chugs away happily.
Re:Using Bun.js as a Bundler by iainmerrick on Thursday May 18, 2023 @03:08AM (#35984906)
Yes, being able to just run TS directly is very appealing. When I last tried, neither bun nor deno nor ts-node worked out of the box for me. The other two seem to be a bit stuck in the weeds (deno aggressively trying to do its own thing, then backtracking and adding node compatibility back in; ts-node hampered by having to work around weird design decisions in both node and TS) so I wouldn’t be surprised if bun ends up as the winning TS engine.
Re:Using Bun.js as a Bundler by intelVISA on Thursday May 18, 2023 @05:25AM (#35985764)
INCREDIBLY less reliable! Even the sole dev would admit as much if you could distract them from their VC handlers.

Gotta go with libre tools for these cases unfortunately. Nothing against Bun specifically of course, just the concept of capital + dev tools is something that must be re-learned as evil time and time again.