Trunk (WASM bundler for Rust) - Tutorial

Try Trunk before Yew tutorial Just follow the simplest official tutorial To understand how Trunk behaves. I’ve simply followed the official getting started. Set up: cargo install trunk cargo new trunk-tutorial cd trunk-tutorial Keep the default Hello world code in src/main.rs. Create index.html: <html> <head> <link data-trunk rel="scss" href="index.scss"/> </head> </html> Create empty index.scss, and bild: trunk build Feb 03 18:59:17.553 INFO 📦 starting build Feb 03 18:59:17.555 INFO spawning asset pipelines Feb 03 18:59:17.

WASM by Rust - Tutorial

Tutorial The URL I followed. https://developer.mozilla.org/en-US/docs/WebAssembly/Rust_to_wasm Pre-requirement You should install npm beforehand. To compile wasm-pack, apt install -y build-essential and install gcc. In case of Ubuntu, apt install -y libssl-dev pkg-config. Download wasm-pack To build the package, we need an additional tool, wasm-pack. This helps compile the code to WebAssembly, as well as produce the right packaging for npm. cargo install wasm-pack Write codes cargo new --lib hello-wasm cd hello-wasm src/lib.