yew-wasm-pack-template is the full-featured counterpart to this template, integrating many common web technologies.
wasm-pack build --target web from your project's root directory.
3) [temporary] Bundle
rollup ./main.js --format iife --file ./pkg/bundle.js from your project's root directory.
4) [optional] Test Run
Run a webserver from your project's root directory, such as with the Python 3 command:
python -m http.server 8080, and load http://localhost:8080/ in a browser to run the app.
Note: It's expected behavior for the browser console to display an error similar to "WebAssembly.instantiateStreaming failed. Assuming this is because your server does not serve wasm with application/wasm MIME type." Your production webserver should be configured to associate WebAssembly files with the
application/wasm MIME type.
Access your generated build artifacts,
yew_wasm_pack_minimal_bg.wasm, in ./pkg from your project's root directory.
This template is designed for compiling Rust libraries into WebAssembly and publishing the resulting package to NPM.
Be sure to check out other
wasm-pack tutorials online for other
templates and usages of
cargo generate to Clone this Template
cargo generate --git https://github.com/rustwasm/wasm-pack-template.git --name my-project cd my-project
🛠️ Build with
🔬 Test in Headless Browsers with
wasm-pack test --headless --firefox
🎁 Publish to NPM with