Hacker News new | past | comments | ask | show | jobs | submit login
Trunk – Build, bundle and ship your rust WASM application to the web (github.com/thedodd)
80 points by maydemir on May 22, 2022 | hide | past | favorite | 12 comments



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.


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.


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.


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.


Is it really that pervasive? Can you elaborate more?


Sorry, purely anecdotal.


You added a reference without actually adding a reference.

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


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...


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?


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.


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.


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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: