A simple way to run Rust WebAssembly in a browser
Fri 10 July 2020
The Rust WebAssemply book has a detailed introduction to WebAssembly in Rust; unfortunately it's example setup is somewhat complicated and requires the use of npm just to run show a simple Hello World! message in the browser.
Luckily, there's a simpler way to get started if you don't care about npm modules.
First, follow the setup instructions to install the rust toolchain, wasm-pack and cargo-generate. You don't need npm.
Clone the example project template:
cargo generate --git https://github.com/rustwasm/wasm-pack-template
which will prompt you for a project name, in the following we'll assume you ...