Building Your First WebAssembly Module

Updated

October 31, 2026

Building Your First WebAssembly Module

// In src/lib.rs
// use wasm_bindgen::prelude::*;
//
// #[wasm_bindgen]
// pub fn add(a: i32, b: i32) -> i32 {
//     a + b
// }

Build the npm package:

wasm-pack build --target web