News for hackers. Stuff that matters.
Re:Farm: Fast vite compatible build tool written in Rust by emmanueloga_ on Saturday June 22, 2024 @12:27AM (#40756270)
Don't forget Bun (*) ... [1]. Bun's bundler is appealing since Bun packages a bunch of other tools you already need (test runner, runtime, fast npm replacement).

Bun + Biome covers everything you need for a TS project (Biome lints and formats).

--

* : I guess it is not written in Rust but still in the same category of tools.

1: https://bun.sh/docs/bundler

Re:Farm: Fast vite compatible build tool written in Rust by spirobelv2 on Saturday June 22, 2024 @03:40AM (#40757201)
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)

Re:Farm: Fast vite compatible build tool written in Rust by mst on Saturday June 22, 2024 @06:17AM (#40757834)
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)
Re:Farm: Fast vite compatible build tool written in Rust by spirobelv2 on Saturday June 22, 2024 @07:39AM (#40758271)
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.

Re:Farm: Fast vite compatible build tool written in Rust by mst on Sunday June 23, 2024 @07:21AM (#40766581)
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.

Re:Farm: Fast vite compatible build tool written in Rust by mst on Sunday June 23, 2024 @03:35PM (#40769981)
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.
Re:Farm: Fast vite compatible build tool written in Rust by spirobelv2 on Monday June 24, 2024 @08:16AM (#40775126)
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.

Re:Farm: Fast vite compatible build tool written in Rust by mark38848 on Saturday June 22, 2024 @02:29AM (#40756840)
Bun would be cool if it worked. At least it's not written in Rust so there's that.
Re:Farm: Fast vite compatible build tool written in Rust by heldrida on Saturday June 22, 2024 @02:38AM (#40756912)
I’ve been using Bun for a year. It works.
Re:Farm: Fast vite compatible build tool written in Rust by veidr on Saturday June 22, 2024 @12:14PM (#40760086)
Neither sentence of your post has any value to anybody, other than (possibly, dubiously) yourself. Next time, consider writing such comments in your personal journal, or perhaps just shouting them out loud when you're alone.
Re:Farm: Fast vite compatible build tool written in Rust by noahtallen on Saturday June 22, 2024 @12:34AM (#40756293)
And Deno! Which also has compilation tools and is written partly in Rust.
Re:Farm: Fast vite compatible build tool written in Rust by emmanueloga_ on Saturday June 22, 2024 @01:32AM (#40756551)
True, although it seems they deprecated their bundle command and even recommend using esbuild or rollup [1] (or an "unstable" module deno_emit).

--

1: https://docs.deno.com/runtime/manual/tools/bundler

Re:Farm: Fast vite compatible build tool written in Rust by brabel on Saturday June 22, 2024 @05:01AM (#40757537)
Yep that was a bummer for me, I was trying to start a little project where I wanted a bundler lib and started using Deno's... but quickly ran into some limitations and found out they've deprecated it and it's not even maintained anymore :( . I started using esbuild instead via its Typescript lib, but then noticed I was spending a lot of time working around the problems with the JS ecosystem (terrible file system watcher in node.js, lots of underpar libraries and as someone not intimate with every domain, it's nearly impossible to know which library may be well written and maintained without spending lots of time investigating, weird APIs, silent errors, I just can't believe some people can cope with all of this instead of just moving to a saner language).... and as esbuild is written in Go, I rewrote my code in Go and now it's much, much nicer to work on, much faster, can be shipped as a single binary etc.

If there was a bundler written in Rust I might have chosen that, as despite not having anything against Go, the momentum seems to be strongly shifting to Rust (and even in the little Go I did, I already feel the pain of its error handling), and Rust definitely gives you better tools to write reliably applications.

Re:Farm: Fast vite compatible build tool written in Rust by sroussey on Saturday June 22, 2024 @12:43PM (#40760306)
I’m a big fan of Bun, and having it just work.

There are still issues (like aborting a fetch, and TS5 style decorators).

But it’s fast and I have all tests run on every save, which are near instant.