Built with:
- Develop: Add code to
lib.rs
- Build: Run
wasm-pack build --target web
from the project root - Import and run code in JavaScript (
index.html
):
<script type="module">
import init, { add } from "./pkg/hello_wasm.js";
await init();
console.log(add(1, 2));
</script>
- Run web server e.g.
python3 -m http.server