Skip to content

SushritPasupuleti/NextJS-WASM

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

NextJS with WASM (Rust)

A repo to test WASM with NextJS.

Setup

Install dependencies:

cd web
yarn

Ensure wasm-pack is installed:

cargo install wasm-pack

Running

Compile the Rust code and start the NextJS dev server:

cd web
yarn dev:wasm

Adding a new WASM module

  1. Create a new Rust crate in wasm/:
# inside nextjs root folder
cd web
cargo new --lib <name>
  1. Add the crate to wasm/Cargo.toml:
[dependencies]
wasm-bindgen = "0.2.85"

[lib]
crate-type = ["cdylib"]
  1. Install module as depencency in web/package.json:
{
  "dependencies": {
    "<name>": "file:../wasm/<name>"
  }
}
  1. Install Install dependencies:
cd web
yarn
cd <lib-name>
yarn

About

A repo to test WASM with NextJS.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published