Skip to content(if available)orjump to list(if available)

Trunk – Build, bundle and ship your rust WASM application to the web

IshKebab

Trunk is great - waaay easier to get started with than the JS/NPM equivalents. Unfortunately it's also quite incomplete. I've only just started but already run into the fact that there's no support for CSS bundling. You basically have to list all of your CSS files manually in your HTML templates, or write your own bundler script.

Still, it's pretty awesome.

the_duke

Fair warning: trunk automatically downloads additional tools at runtime. It doesn't even prefer already installed local versions, and doesn't provide a way to disable downloading. It will even download older tool versions than the currently installed one, because the exact version is pinned code.

This was enough for me to not use it.

gspr

I love Rust. It's the most I've enjoyed any programming language, barring perhaps Haskell. But the fact that the culture is rife with stuff like this annoys me to no end.

BiteCode_dev

In Python it's the opposite, as we good serious bootstrapping problems, and people complain for different reasons.

In C, people complain because tooling is too complex, in Haskell because 3rd party tools are unreliable, in PHP because it's riddle with security issues, in JS because it breaks compat regularly, etc.

There is always something it seems.

golergka

Is it really that pervasive? Can you elaborate more?

gspr

Sorry, purely anecdotal.

fastball

You added a reference without actually adding a reference.

This was enough for me to ignore the rest of your comment.

jka

Naive question: what's the advantage of this compared to using 'npm init wasm-app'[1], importing your Rust WASM module from JavaScript, and iterating from there?

[1] - https://rustwasm.github.io/docs/book/game-of-life/hello-worl...

cagenut

I'm completely new to the rust ecosystem, but am I reading this right, this is basically a dev webserver for running in your checkout and testing locally?

Is this a competitor to an incumbent as I cant imagine something like that doesnt already exist?

steve_adams_86

My understanding is that it provides configurable WASM/HTML/JS/SCSS bundling and a dev server so you can easily edit and live reload your DOM and WASM code that’s being bundled.

It sounds like it could reduce friction around this kind of development a lot. There are probably similar things though, you’re right. I’m not sure how this compares, but I like the sounds of it a lot.

kryptiskt

It's for building frontend apps in Rust by compiling to Webassembly, that is still pretty niche compared to using it for the backend, so it's not strange that there isn't a very polished incumbent for that role. Of course, you could just use the tools from the JS ecosystem instead. When I played around with Rust WASM, I used Snowpack and called out to cargo to do the Rust build.

terhechte

I've recently used trunk for the first time. It is a huge improvement to the current way of building a Rust wasm app. For one of my apps that doesn't use trunk, I'm maintaining these two scripts to set up a system and to compile a wasm bundle:

- https://github.com/terhechte/postsack/blob/main/postsack-web... - https://github.com/terhechte/postsack/blob/main/postsack-web...

Trunk allows me to remove these scripts and offers live reloading of changes in my Rust code. It is a great experience. I know that there're similar tools for React etc, but I'm not aware of another tool that works this well with Rust.