Skip to content

A webpack + react + rust template to start your next WebAssembly project with

Notifications You must be signed in to change notification settings

flowsn4ke/wasm-react-webpack-template

 
 

Repository files navigation

Rust WebAssembly React Template

Template Test & Build

A slightly opinionated webpack build to start your next wasm project.

Setup

A simple 'yarn' and 'yarn start' should do the trick. File an issue if it doesn't!

src is where your rust code can go. js is where you can find your react :)

Optimizations

As of now wasm-pack can't compile on certain machines (like mac m1) if you don't disable optimizations. You can, however, perform the optimizations manually on the file using wasm-opt (which you'll need to install with brew on mac using the following command: brew install binaryen) like so:

  • Optimize for size. wasm-opt -Os -o output.wasm input.wasm

  • Optimize aggressively for size. wasm-opt -Oz -o output.wasm input.wasm

  • Optimize for speed. wasm-opt -O -o output.wasm input.wasm

  • Optimize aggressively for speed. wasm-opt -O3 -o output.wasm input.wasm

Note the output filename can and should be the same as the input filename (otherwise you're in for a headache renaming everything).

About

A webpack + react + rust template to start your next WebAssembly project with

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 34.1%
  • TypeScript 32.2%
  • JavaScript 19.3%
  • CSS 8.5%
  • HTML 5.9%