bordalix / zeroconf

Home Page:https://zeroconf.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

React Application using Web-Assembly (Rust)

You must have node (and npm) installed.

Initialize React project

npx -y create-react-app wasm-rust-react --template typescript

Install tools

Install rust related tools using the setup script:

bash setup.sh

Or create new rust lib:

cargo new rust-libs --lib
cd rust-libs
cargo add wasm-bindgen

Change crate-type in Cargo.toml and add rust byproducts in .gitignore.

[lib]
crate-type = ["cdylib"]

Build the rust libs:

wasm-pack build --target web

Install/add package to npm:

npm i ./rust-libs/pkg

Or add "rust-libs": "file:rust-libs/pkg" to package.json dependencies, and run:

npm i

Start development server:

npm start

Running wasm in a web worker.

npm i @shopify/web-worker

Currently, the shopify lib might have some issues, or my implementation is not correct.

Resources

About

https://zeroconf.vercel.app


Languages

Language:JavaScript 54.3%Language:Rust 38.7%Language:CSS 5.7%Language:HTML 0.6%Language:Shell 0.3%Language:Dockerfile 0.3%