Getting Started
You will need a couple of tools to compile, build, package and debug your Yew application. When getting started, we recommend using Trunk. Trunk is a WASM web application bundler for Rust.
Installing Rust
To install Rust, follow the official instructions.
The minimum supported Rust version (MSRV) for Yew is 1.76.0
. Older versions will not compile.
You can check your toolchain version using
rustup show
(under "active toolchain") or rustc --version
. To update your
toolchain, run rustup update
.
Install WebAssembly target
Rust can compile source codes for different "targets" (e.g. different processors). The compilation
target for browser-based WebAssembly is called wasm32-unknown-unknown
. The following command will
add the WebAssembly target to your development environment.
rustup target add wasm32-unknown-unknown
Install Trunk
Trunk is the recommended tool for managing deployment and packaging and is used throughout the documentation and examples.
# note that this might take a while to install because it compiles everything from scratch
# Trunk also provides prebuilt binaries for a number of major package managers
# See https://trunkrs.dev/#install for further details
cargo install --locked trunk