A simple Chrome extension that demonstrates using Rust with WebAssembly.
- Install dependencies:
# Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Install wasm-pack
cargo install wasm-pack- Build the extension:
npm run build- Load in Chrome:
- Open
chrome://extensions - Enable Developer mode
- Click "Load unpacked"
- Select the
distdirectory
npm run clean- Clean all build outputsnpm run build- Build the extension
rust-chrome-extension/
├── Cargo.toml # Rust dependencies and build config
├── src/
│ └── lib.rs # Rust code (WebAssembly source)
├── manifest.json # Chrome extension manifest
├── popup.html # Extension popup UI
├── popup.js # JavaScript code for the popup
└── pkg/ # Generated after build (contains compiled WebAssembly)
├── rust_chrome_extension_bg.wasm
└── rust_chrome_extension.js