21 comments

[ 0.29 ms ] story [ 56.0 ms ] thread
I've used Trunk for about a year on an app I'm slowly building and it's worked well. I would vouch for it.

It's a little light on maintainers. They shipped one version that was broken for my use case and it took maybe a week or two for things to get corrected, but was an innocent enough mistake and they were responsive on Discord. Other than that, no issues, works exactly like you'd expect.

Maybe you can help me understand how this differs from wasm-pack?
It's significantly easier to configure - as in, I use it without any configuration whatsoever in my current project. Just drop an html file in your crate and run `trunk serve`.
(comment deleted)
Same here, have used trunk for over year and find it very easy to work with. I use it with egui and it has made distribution of my stuff really easy.
+1 for trunk. In comparison with Vite, webpack, etc it's not as mature. Fewer plugins and stuff, but for the use cases it supports it's great. I use it to package a static Yew frontend and it works with minimal fuss and has hot-reload for dev too.
I'm curious about "static Yew frontend ". If your content is static, why bother with a React-like tool, let alone one that compiles to wasm? Or have I misunderstood the term used here?
Static content does not imply non-interactive.

Think video games, they can be fully static content yet highly interactive.

It is the interactivity aspect of an app that makes it a good use case for something like yew or react.

Since it is static, you don't need a server, but you can still benefit from the wasm performance and yew DX.

Great example, thank you. I had indeed conflated "static" with "non-interactive," and I definitely see how Yew could be a great fit for this sort of content. I appreciate the clarification!
Are there any examples?
Not much code to show, but here :)

Install: https://github.com/MeoMix/symbiants/blob/master/.devcontaine...

Link to the build artifacts: https://github.com/MeoMix/symbiants/blob/master/index.html#L...

Minor config change to expose loopback for local testing from external device: https://github.com/MeoMix/symbiants/blob/master/Trunk.toml#L...

Then `trunk serve` to spin up a server on localhost:8080 with Rust package running in the browser.

Release build: https://github.com/MeoMix/symbiants/blob/master/.github/work...

Production code: https://ant.care/

Us, from Trunk.io: "Oh look we're at the top of Hackernews! Oh wait it's not us"
I wish wasm related projects gave stats or benchmarks on payload size as that has always been an issue for me adopting and I usually only find out after building something small to test.
I've been using trunk for about a year and it hasn't gotten in my way at all. I used wasm-pack before but I prefer the trunk workflow. I was surprised how easy it was to add an external crate as a web worker.
I'd use this to write frontend stuff in rust? I'm a little behind the times on web stuff but I was just thinking I have a simple web app with long polling I need to write, and even though it's total overkill I'd rather do it in rust than TS
I've used Trunk in my personal project for years. Very glad we have a handy tool to match the experience we develop with JavaScript. Now there are more and more front-end web devtools rewritted from Node.js to Rust for performance, Trunk is already in Rust since created.
This is pure cancer for the web we know.