5 ms·
Trunk: Build, bundle and ship your Rust WASM application to the web
- SeanAnderson 2y agoI'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.
- ModernMech 2y agoMaybe you can help me understand how this differs from wasm-pack?
- swiftcoder 2y agoIt'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`.
- deleted 2y ago[deleted]
- smodo 2y agoSame 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.
- bippihippi1 2y ago+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.
- deciduously 2y agoI'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?
- eddd-ddde 2y agoStatic 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.
- deciduously 2y agoGreat 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!
- throwaway77385 2y ago[dead]
- eamag 2y agoAre there any examples?
- SeanAnderson 2y agoNot much code to show, but here :) Install: https://github.com/MeoMix/symbiants/blob/master/.devcontainer/Dockerfile#L23 https://github.com/MeoMix/symbiants/blob/master/.devcontaine... Link to the build artifacts: https://github.com/MeoMix/symbiants/blob/master/index.html#L6 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#L3 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/workflows/deploy-page.yaml#L31 https://github.com/MeoMix/symbiants/blob/master/.github/work... Production code: https://ant.care/ https://ant.care/
- paulgb 2y agoThe Yew (React-like framework for Rust) tutorial uses Trunk and I find it to be a pretty good introduction: https://yew.rs/docs/tutorial https://yew.rs/docs/tutorial
- eslaught 2y agoeframe_template uses Trunk for their wasm build: https://github.com/emilk/eframe_template 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.stanford.edu/~eslaught/pennant_gpu_kernels/ https://legion.stanford.edu/prof-viewer/?url=https://sapling...
- gewenyu99 2y agoUs, from Trunk.io: "Oh look we're at the top of Hackernews! Oh wait it's not us"
- ActionHank 2y agoI 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.
- isosphere 2y agoI'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.
- chaosprint 2y agois 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/pull/322 https://github.com/trunk-rs/trunk/issues/414 https://github.com/trunk-rs/trunk/issues/414
- 01HNNWZ0MV43FF 2y agoI'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
- jiyinyiyong 2y agoI'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.
- JoosToopit 2y agoThis is pure cancer for the web we know.