wasm-pack VS trunk

Compare wasm-pack vs trunk and see what are their differences.

wasm-pack

📦✨ your favorite rust -> wasm workflow tool! (by rustwasm)

trunk

Build, bundle & ship your Rust WASM application to the web. (by trunk-rs)
Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
wasm-pack trunk
38 53
5,923 3,161
2.0% 3.0%
7.0 9.6
5 days ago 6 days ago
Rust Rust
Apache License 2.0 Apache License 2.0
The number of mentions indicates the total number of mentions that we've tracked plus the number of user suggested alternatives.
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

Posts with mentions or reviews of wasm-pack. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-07-18.
  • Rust + WASM + Typescript [+ React]
    7 projects | /r/rust | 18 Jul 2023
    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
    5 projects | dev.to | 8 May 2023
    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)
    2 projects | dev.to | 28 Apr 2023
    Support using wasm-pack in Worklets (particularly AudioWorklet) #689
  • Hey Rustaceans! Got a question? Ask here (3/2023)!
    12 projects | /r/rust | 16 Jan 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)
    6 projects | dev.to | 8 Jan 2023
    Webassembly: wasm-bindgen 0.2.83 / wasm-pack 0.10.3
  • Examples of Rust + SvelteKit + WASM
    2 projects | /r/rust | 6 Oct 2022
    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
    4 projects | dev.to | 3 Oct 2022
    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
    9 projects | /r/rust | 6 Sep 2022
    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?
    3 projects | news.ycombinator.com | 4 Jul 2022
    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
    4 projects | dev.to | 29 Jun 2022
    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.

trunk

Posts with mentions or reviews of trunk. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2024-03-26.
  • Migrating a JavaScript frontend to Leptos, a Rust framework
    4 projects | dev.to | 26 Mar 2024
    Note that Leptos uses Trunk to serve the client side application. Trunk is a zero-config Wasm web application bundler for Rust.
  • Why Is the Front End Stack So Complicated?
    1 project | news.ycombinator.com | 16 Oct 2023
    I've been using Rust and WASM for my latest front-end project, and I think this setup is a viable alternative to commonly used JS frameworks for those willing to put in some effort to ramp up on new technology. Addressing the concerns from the article:

    "No universal import system" - Rust has it's own module system and Cargo is used for managing dependencies, no need to worry about different module systems.

    "Layers of minification, uglification, and transpilation." Just compile Rust to WASM file for the browser, same as using any other compile target.

    "Wildly different environments." Something that you'll still need to deal with. Some runtime dependencies are system-specific (code running on the browser usually needs access to Web APIs, and JavaScript, code running on the server can't access WebAPIs but can access the system clock and filesystem. Sometimes separate libraries or separate runtime configs are needed (e.g. configurable time source)

    "Overemphasis on file structure." Not a problem for imports, but you may still have file structure dependencies things like CSS, image resources etc.

    "Configuration hell." Pretty much non-existent once you have your Rust compiler setup locally.

    "Development parity." Just use trunk: https://trunkrs.dev/, to watch, build and serve, config is minimal.

  • PSA: Rust web frontend with Tailwind is easy!
    3 projects | /r/rust | 1 Jul 2023
    Trunk, the Rust-equivalent of Webpack & Vite, comes with tailwind built-in. You heard that right! You don't even need to install the tailwind CLI via npm or something like that. No more package.json! <3
  • Awesome presentation of Dioxus - cross-platform GUI framework at RustNL
    3 projects | /r/rust | 14 Jun 2023
    Can you not use dioxus with "trunk" (https://trunkrs.dev/) ?
  • A Chess Engine is written in Rust that runs natively and on the web!
    4 projects | /r/rust | 30 Mar 2023
    Thanks a lot! As I said in an earlier comment, building this allowed me to explore a lot of features of rust like Traits, Dynamic Dispatch, Pattern Matching, Const evaluation, Static variables, etc. and that on top of that trying to figure out how to conveniently port it to WASM was also a nice learning experience. I am currently using trunk as a bundler which ties in neatly with a GitHub action but before that, I tried cargo-run-wasm, which felt a little hacky. So overall a whole lot of learning.
  • Speak English to me, The secret World of Programmers
    7 projects | news.ycombinator.com | 16 Mar 2023
    Here here. I don't think programmers - as a group - get to complain about people not learning programming tools while simultaneously making them so unapproachable (especially Linux things).

    It's not just the overuse of acronyms. There's also:

    * Religious devotion to the CLI despite it having terrible discoverability.

    * Really bad naming. Git is probably the worst offender at this, but the whole of Unix is a naming mess. WTF is `usr`? Is that where user files go?

    * Generally over-complicated tooling. A good example of this is Node/NPM. So complicated to set up! Contrast it with https://trunkrs.dev/

    * Deification of distro packages. No I do not want to spend half of my development time packaging my app for 10 different distros. I guess I'll go with curl | bash then.

    * Distain for binary app distribution. I'm looking at you glibc.

  • Helper/cheat tool for the board game Cryptid - my first website built with Rust/Wasm
    1 project | /r/rust | 7 Mar 2023
    I used Notan for drawing the game board in combination with the excellent egui for adding UI elements. It was surprisingly easy to bring it to web with Trunk.
  • MailCrab
    4 projects | news.ycombinator.com | 5 Mar 2023
    Hi, the author of MailCrab here :-) Yew is nice, especially if you enjoy writing Rust. However, it definitely takes more time and dedication than writing a frontend in React, Vue etc. Yew and the surrounding ecosystem keeps improving, and it is way more usable than when I first tried it. The tooling I used (Trunk https://trunkrs.dev/) is very minimal with respect to the number of features compared to many of the popular web-bundlers (Webpack etc.) but it works well for most simple use-cases.
  • Is rust + yew a good starting point for learning web dev?
    2 projects | /r/rust | 21 Oct 2022
    Yew is way way nicer in that regard because it uses Trunk which is very excellent and you don't have to deal with any of that really. Just trunk serve and away you go. Plus you get the advantage of not having to deal with Javascript. Typescript is nice, but it's no Rust.
  • Junior Dev here -- How are we setting up Rust, WASM, and webpack?
    4 projects | /r/rust | 28 Sep 2022
    The alternative to wasm-pack is trunk. I've never used it, so I can't tell you how good it is.

What are some alternatives?

When comparing wasm-pack and trunk you can also consider the following projects:

wasm-bindgen - Facilitating high-level interactions between Wasm modules and JavaScript

tailwind-yew-builder - Build tailwind css for yew style applications, using docker-compose, so you don't need to have npm installed

vite-plugin-rsw - 🦞 wasm-pack plugin for Vite

wasmtime - A fast and secure runtime for WebAssembly

yew - Rust / Wasm framework for creating reliable and efficient web applications

capacitor - Build cross-platform Native Progressive Web Apps for iOS, Android, and the Web ⚡️

cargo-generate - cargo, make me a project

awesome-vite - ⚡️ A curated list of awesome things related to Vite.js

comlink - Comlink makes WebWorkers enjoyable.

wasm-bindgen-rayon - An adapter for enabling Rayon-based concurrency on the Web with WebAssembly.