Skip to main content
Version: 0.19.0

Using trunk


cargo install --locked trunk
cargo install wasm-bindgen-cli


Check out "Build a sample app" for a short guide on how to build Yew apps with Trunk.

You can also see it in action by looking at our examples, all of which are built with Trunk.

Trunk builds your app based on the index.html file which serves as a config file of sorts. Unlike wasm-pack, this tool is actually designed to build apps. This means you don't need to add cdylib as a library target and you can use the main function as an entry point.

To build a simple Yew app you just need an index.html file at the root of your project:

<!doctype html>
<meta charset="utf-8" />
<title>Yew App</title>

The Trunk CLI provides several useful commands but during development trunk serve is certainly the most useful one. It runs a local server for you and automatically rebuilds the app when it detects changes.

When you're ready to release your app, you can just run trunk build --release.

This summary here doesn't nearly cover all of Trunk's features, be sure to check out the README!