back
19 comments
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.

+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!
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.
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`.
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 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.
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 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.
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/

The Yew (React-like framework for Rust) tutorial uses Trunk and I find it to be a pretty good introduction: https://yew.rs/docs/tutorial
eframe_template uses Trunk for their wasm build:

https://github.com/emilk/eframe_template

Demo of an application built with Trunk (this is a profiler for a distributed runtime system):

https://legion.stanford.edu/prof-viewer/?url=https://sapling...

is there any doc for header support? I noticed it when using egui but without cors this cannot be used for my project...

https://github.com/trunk-rs/trunk/pull/322

https://github.com/trunk-rs/trunk/issues/414

This is pure cancer for the web we know.
Us, from Trunk.io: "Oh look we're at the top of Hackernews! Oh wait it's not us"