[HN Gopher] Trunk: Build, bundle and ship your Rust WASM applica...
___________________________________________________________________
Trunk: Build, bundle and ship your Rust WASM application to the web
Author : 0xedb
Score : 87 points
Date : 2024-07-23 14:15 UTC (8 hours ago)
(HTM) web link (trunkrs.dev)
(TXT) w3m dump (trunkrs.dev)
| SeanAnderson wrote:
| 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.
| ModernMech wrote:
| Maybe you can help me understand how this differs from wasm-
| pack?
| swiftcoder wrote:
| 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`.
| smodo wrote:
| 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.
| bippihippi1 wrote:
| +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 wrote:
| 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?
| eddd-ddde wrote:
| 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.
| deciduously wrote:
| 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!
| eamag wrote:
| Are there any examples?
| SeanAnderson wrote:
| 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/
| paulgb wrote:
| 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
| eslaught wrote:
| 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...
| gewenyu99 wrote:
| Us, from Trunk.io: "Oh look we're at the top of Hackernews! Oh
| wait it's not us"
| ActionHank wrote:
| 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.
| isosphere wrote:
| 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.
| chaosprint wrote:
| 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
___________________________________________________________________
(page generated 2024-07-23 23:08 UTC)