News for hackers. Stuff that matters.
Re:Using Bun.js as a Bundler by afavour on Wednesday May 17, 2023 @06:37PM (#35982114)
This is awesome but in case anyone was wondering: the author was previously using Webpack rather than a newer generation tool. So the speed benefits outlined here would likely be the same if they were still using Node with esbuild instead.

Overall I like Bun - diversity in JS ecosystems is a great thing - but I’m struggling to come up with reasons to actually use it (which is fine! As long as the author is enjoying the work, why not?)

Re:Using Bun.js as a Bundler by paulddraper on Wednesday May 17, 2023 @06:39PM (#35982137)
You can see at the beginning of the article a benchmark comparison with Webpack and esbuild.
Re:Using Bun.js as a Bundler by brundolf on Wednesday May 17, 2023 @06:56PM (#35982276)
They weren't using SWC? They describe deploying to Vercel, and Next.js has had stable built-in support for SWC for a good while now
Re:Using Bun.js as a Bundler by byhemechi on Thursday May 18, 2023 @02:07AM (#35984576)
iirc next.js only uses swc for the dev mode bundler

edit: this is no longer the case, ignore me :)

Re:Using Bun.js as a Bundler by re-thc on Thursday May 18, 2023 @04:50AM (#35985490)
Webpack is the bundler. SWC as used in Next.js doesn't do the bundling part.
Re:Using Bun.js as a Bundler by icemelt8 on Thursday May 18, 2023 @07:07AM (#35986364)
I also didn't understand this, if they were using NextJS, why do they have a custom webpack config? My assumption is that there is a separate web app that does the drawing and coloring, they bundle it into a script.js and include it in their nextJS page.
Re:Using Bun.js as a Bundler by shaneos on Thursday May 18, 2023 @07:44AM (#35986620)
Yes, this is correct. All the canvas stuff has nothing to do with React, so I bundle it all separately. In fact, I don't even load React on the browser, I just render the initial page with it on the server then just work with the DOM from there on out. It greatly reduces the amount of JS shipped to the client, and since 90% of my code was going to be Canvas related, it's not much overhead to add a few click listeners for various DOM nodes
Re:Using Bun.js as a Bundler by brundolf on Thursday May 18, 2023 @10:49AM (#35988774)
Ah true, my bad. Though it's still relevant to mention, because usually when people hear "using Webpack" they also assume "using Babel". Bun is doing both the bundling and the transpiling, so it should be compared to the bundler + transpiler combination
Re:Using Bun.js as a Bundler by taosx on Wednesday May 17, 2023 @08:15PM (#35982803)
I use it a lot for small cli apps and during dev, it's so nice to be able to run typescript files with bun instead of tsx or ts-node.
Re:Using Bun.js as a Bundler by white_dragon88 on Wednesday May 17, 2023 @08:22PM (#35982835)
I use esbuild-runner, it works fine for me
Re:Using Bun.js as a Bundler by sroussey on Thursday May 18, 2023 @02:29AM (#35984684)
Yes, I love bun for running typescript cli apps. 40x80 or some such is hardwired as the screen size though, and without raw mode, things like terminal window “controls” are broken.
Re:Using Bun.js as a Bundler by Jarred on Thursday May 18, 2023 @02:33AM (#35984707)
Yeah we need to fix raw mode
Re:Using Bun.js as a Bundler by 000ooo000 on Wednesday May 17, 2023 @08:50PM (#35983003)
>I’m struggling to come up with reasons to actually use it (which is fine! As long as the author is enjoying the work, why not?)

I wish more people, or at least more HN commenters, had this attitude. Don't have to look hard to find negativity in response to folks getting out there and having a go. How many passion projects went nowhere* but taught authors valuable shit that lead to incredible engineering and projects? Besides, I love writing software and anyone who says I shouldn't because it isn't going to be better than the status quo can beat it.

*not implying Bun is going nowhere. Be gone, pedants.

Re:Using Bun.js as a Bundler by tawal on Friday May 19, 2023 @04:31AM (#35999299)
You're right ! I think many software engineers shits on project may be based on their experiences and forgets that these projects can driven in future awesome creations