https://github.com/pranabdas/wasm-rust-react
Build next generation web applications with near native performance using WebAssembly (transpiled from Rust code).
https://github.com/pranabdas/wasm-rust-react
react rust wasm wasm-bindgen wasm-pack webassembly webworker
Last synced: 5 months ago
JSON representation
Build next generation web applications with near native performance using WebAssembly (transpiled from Rust code).
- Host: GitHub
- URL: https://github.com/pranabdas/wasm-rust-react
- Owner: pranabdas
- Created: 2022-11-15T14:26:27.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-16T09:41:42.000Z (12 months ago)
- Last Synced: 2024-10-18T04:54:14.701Z (12 months ago)
- Topics: react, rust, wasm, wasm-bindgen, wasm-pack, webassembly, webworker
- Language: TypeScript
- Homepage: https://pranabdas.github.io/wasm-rust-react/
- Size: 1.49 MB
- Stars: 8
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# React Application using Web-Assembly (Rust)
You must have node (and npm) installed.
### Initialize React project
```console
npx -y create vite@latest wasm-rust-react -- --template react-ts
```### Install tools
Install rust related tools using the setup script:
```console
bash setup.sh
```Create new rust lib:
```console
cargo new rust-libs --lib
cd rust-libs
cargo add wasm-bindgen
```Change crate-type in `Cargo.toml` and add rust byproducts in `.gitignore`.
```rs
[lib]
crate-type = ["cdylib"]
```Build the rust libs:
```console
wasm-pack build --target web
```Install/add package to npm:
```console
npm i ./rust-libs/pkg
```Or add `"rust-libs": "file:rust-libs/pkg"` to `package.json` dependencies, and
run:
```console
npm i
```Start development server:
```console
npm start
```To update rust dependencies:
```console
cargo install cargo-update --features vendored-openssl
cargo install-update -a
```### Resources
- https://rustwasm.github.io/docs/book/