This example shows how to build a typed and optimized WebAssembly module from Rust and dynamically import it inside of Next.js.
Clone repo and install dependencies:
git clone https://github.com/comingAlive/next-wasm-example.git
cd next-wasm-example
npm install
# or
yarn
To compile Rust code src/lib.rs
to pkg
module you'll have to install
Rust. Then run:
npm run build-rust
# or
yarn build-rust
Start Next.js app:
npm run dev
# or
yarn dev