An example webapp that uses wasm-pack and svelte for using Rust in the browser.
First, make sure all necessary tools are available:
# .envrc
PATH_add "$(nix-build --no-link \
--tarball-ttl 0 \
https://github.com/nmattia/dune/archive/master.tar.gz \
--argstr user "$USER" --argstr path "$PWD" \
--arg packages '[ "rustc" "cargo" "rustfmt" "nodejs" "wasm-pack" ]' \
--arg env '[ "HOME='"$PWD"'/.home" ]' \
)/bin"
Then, build the wasm file:
cd lib && wasm-pack build
Then run the webapp:
cd svelte-app && npm ci && npm run dev