Hacker News new | past | comments | ask | show | jobs | submit login

there is a small difference: you also need to make your own hmr reloading script when using bun. But it does so much more than just frontend bundleing.

If you need an hmr script you can use the one I wrote for my webframework: https://github.com/spirobel/mininext

(my goal with mininext is to provide index.php like productivity but with all of npm and typescript at your fingertips)




I may be wrong here but I think https://modern-web.dev/docs/dev-server/overview/ could do server-with-HMR for a Bun .js tree? (unsure how you'd handle .ts there, sorry, still caffeinating)


the goal was to not have any dependencies.

mininext has a clean package.json

It is just 3 files of modest size that are understandable in an afternoon.

You can also copy and paste and vendor the hmr part.

Someone even forked mininext to create micronext.

My goal is to compete with php. So I added some quality of life features. But if people want to go turbo minimalistic I can respect that.

I just wouldn't add a dependency for hmr when it is so easy to do with a small snippet.


Sure. This was wrt "when using bun" - i.e. somebody else might prefer to just whack web-dev-server into place as a lightweight option for them.

mininext is a neat idea and I plan to read through the code (do you have a preferred 'small snippet' for hrm? I'd be interested to read that too) but I was talking more generally in my last comment.


Sorry for the silly question, I found the standardDevReloader stuff, hadn't realised it was built in. Not what I was hoping for since I want per-library reloading, but for the goals of mininext that's probably overkill anyway.


haha no worries :-D

I like to keep it simple. Right now bun just rebuilds everything and it is so fast that I don't recognize it.

If it ever becomes a problem I will optimize it.

The standardDevReloader is a snippet to tell the browser to refresh the page after a rebuild happened.

If you setup a fresh project with the barebones quickstart template with: bun create spirobel/aldi yournewproject

you will see a dev.ts in the project folder. compared to the start.ts (which is used to run the prod version) it will setup this snippet, so it is included in every html page that is served.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: