Up-to-date documentation generated with rustdoc
can be found here.
Install Rust via the rustup
toolchain manager.
The "normal" way to compile rust code for the web nowadays would be to use the wasm-pack
utility.
However, I don't really like installing a separate tool globally just to build a variant of a project.
Furthermore, wasm-pack
doesn't do much anyways if you look more closely and instead makes the build process more opaque.
I therefore decided to go the extra mile and keep all the build logic within cargo
instead.
To get started with the wasm build you will need to install the wasm target like so:
rustup target install wasm32-unknown-unknown
Afterwards, our custom cargo subcommand cargo wasm --release
will do the rest.
Tip for vscode: When developing for the browser it makes sense to change the default target in
settings.json
like so:"rust-analyzer.cargo.target": "wasm32-unknown-unknown"
- Run
cargo checkit
locally to see if our CI checks are ok, especially before opening a PR or pushing tomain
- By running
cargo wasm serve
you can quickly start a local development server to try out thewasm
build