```toml
[dependencies] cellular-automaton = "0.1.8" ```
Compile, generate .js
and .d.ts
bindings, and generate an npm
package with wasm-pack
sh
wasm-pack build
Compile and generate .js
and .d.ts
bindings with wasm-bindgen-cli
Install the wasm32-unknown-unknown
compilation target
sh
rustup target add wasm32-unknown-unknown
Build
sh
cargo build --target wasm32-unknown-unknown
Run
sh
wasm-bindgen --out-dir pkg/ ./target/wasm32-unknown-unknown/release/cellular_automaton.wasm
Optimize for binary size with wasm-opt
using -Os
or -Oz
sh
wasm-opt -Os ./pkg/cellular_automaton_bg.wasm -o ./pkg/cellular_automaton_bg.wasm