Small template for compiling Rust to WebAssembly with webpack and live reloading.
Based on rust-wasm-webpack-tutorial. Differences:
- uses
webpack-dev-server
to automatically recompile and reload the browser window on file changes during development - optimized production build (see below)
- set up Rust and Emscripten for compiling to WebAssembly, for example using the beginning of this guide.
npm install
npm run start
(builds, starts dev server and opens http://localhost:8080)- change the Rust or JavaScript code and watch the browser reload after a few seconds
Use npm run build
to generate an optimized build in the dist
folder (compiling the Rust code in release mode and using UglifyJS for minifying the JavaScript code). To deploy to GitHub pages use npm run deploy
.