wasm-pack
wasm-pack-template
Our great sponsors
wasm-pack | wasm-pack-template | |
---|---|---|
38 | 4 | |
5,911 | 589 | |
1.8% | 2.4% | |
7.0 | 0.8 | |
9 days ago | 8 months ago | |
Rust | Rust | |
Apache License 2.0 | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
wasm-pack
-
Rust + WASM + Typescript [+ React]
For a much simpler but less flexible approach there's wasm-pack for creating JS packages from Rust, and wasm-bindgen for easy interop. Both have very good documentation.
-
Tower of Hanoi in P5.js + WASM
After four years, I found some time to pay that deb-tech (yes, quite a long time, eh). To make it fun I rewrote everything from scratch in SolidJS, which went smooth thanks to this amazing library p5js-wrapper. For WASM, C++ is still a good choice, but what about Rust? I did some research and found wasm-pack. A few lines in the cargo.toml file and we were ready to generate compiled + ready to import bytecode!
-
How to Use Rust Code in a JavaScript Worklet (Without wasm-pack)
Support using wasm-pack in Worklets (particularly AudioWorklet) #689
-
Hey Rustaceans! Got a question? Ask here (3/2023)!
If you're looking to use it to interface with node/browsers, then try wasm-pack.
-
Rust WebAssembly (wasm) on Arch Linux with Webpack (Rust 1.66.0)
Webassembly: wasm-bindgen 0.2.83 / wasm-pack 0.10.3
-
Examples of Rust + SvelteKit + WASM
wasm-pack has bugs - it publishes a module which declares itself as a commonjs module. (You can fix that by manually adding "type": "module" in package.json). Then the web build should work with other bundlers. I opened an issue about this over a year ago. There's a PR and everything, but no movement :/
-
Building a web application with Rust and WebAssembly
wasm-pack helps you build Rust-generated WebAssembly packages and use it in the browser or with Node.js.
-
A Look at Performance in Wasmtime and Cranelift
Is the Rust WASM ecosystem being half dead better? wasm-pack and wasm-bindgen are barely maintained anymore, and trust me it's not because everything works flawlesslyβ¦
-
Ask HN: Should I learn Rust or Go?
I've been learning Rust for the past few weeks and have been enjoying it a lot.
- The community is very helpful on Discord (https://discord.com/invite/rust-lang-community).
- The package ecosystem (crates.io) makes it very easy to find and import things, and they're consistently documented.
- There's a path to compiling on web via WebAssembly (https://rustwasm.github.io/wasm-pack/)
In a few weeks of learning the language, I managed to put together this visualization: https://twitter.com/admiralakk/status/1542560489091350529
But realistically, either Go or Rust will be fine. You should pick the one you're more likely to stick with and learn, even when it gets tough. I've found the community aspect to be very helpful, because then at least I know I'm not the only idiot out there.
-
Integrating a Svelte app with Rust using WebAssembly
There are various ways to set up a web project that uses Svelte, Wasm, and Rust. For example, wasm-pack from the rust-wasm group provides a template for simple HTML-CSS-JS applications. There are also several project templates for React or Svelte with Rust and Wasm.
wasm-pack-template
-
Implement React v18 from Scratch Using WASM and Rust - [1] Build the Project
. βββ Cargo.toml βββ package.json βββ examples β βββ hello-world // React project initialized by vite βββ packages β βββ react // WASM project created by cargo generate --git https://github.com/rustwasm/wasm-pack-template β βββ react-dom // WASM project created by cargo generate --git https://github.com/rustwasm/wasm-pack-template β βββ react-reconciler // Rust project created by cargo new β βββ shared // Rust project created by cargo new
-
What's the best way to generate WASM programmatically?
I use this https://github.com/rustwasm/wasm-pack-template
-
Hey Rustaceans! Got an easy question? Ask here (30/2021)!
Ah, it looks like it requires for tests to be prepended with #[wasm_bindgen_test]; not sure if this will help you, then :-//
-
Rust on the front-end
The first tutorial step focuses on the setup. It's short and is the most "copy-pastey" of all. The reason for that is that it leverages cargo-generate, a Cargo plugin that allows creating a new project by using an existing Git repository as a template. In our case, the template is a Rust project ready to compile to Wasm. The project's structure is:
What are some alternatives?
trunk - Build, bundle & ship your Rust WASM application to the web.
macroquad - Cross-platform game engine in Rust.
wasm-bindgen - Facilitating high-level interactions between Wasm modules and JavaScript
create-wasm-app - npm init template for consuming rustwasm pkgs
vite-plugin-rsw - π¦ wasm-pack plugin for Vite
cargo-generate - cargo, make me a project
wasmtime - A fast and secure runtime for WebAssembly
capacitor - Build cross-platform Native Progressive Web Apps for iOS, Android, and the Web β‘οΈ
cargo-generate - cargo, make me a project [Moved to: https://github.com/cargo-generate/cargo-generate]
rust-game-of-life