Skip to content

Latest commit

 

History

History
17 lines (13 loc) · 1.05 KB

README.md

File metadata and controls

17 lines (13 loc) · 1.05 KB

rust-wasm-webpack-template

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)

Live Demo

Usage

  • 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

Production build

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.