Junior Dev here -- How are we setting up Rust, WASM, and webpack?

This page summarizes the projects mentioned and recommended in the original post on /r/rust

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • wrend

    A framework-agnostic Rust/WASM + WebGL2 Rendering library, compatible with calling from both Rust and JavaScript on the web.

  • I think initially I used their autogenerated templates and other's templates as well, but lately, in my own personal projects, I've started rolling my own Webpack config (v5) with WasmPlugPlugin, which seems to work decently well most of the time. Here's one of my recent frontend crates that is fairly standalone and can be copied if you want a starter template that has been recently updated and has a good chance of compiling / working correctly for you with minimal dependencies: https://github.com/austintheriot/wrend/tree/master/examples/vanilla_rs

  • wee_alloc

    The Wasm-Enabled, Elfin Allocator

  • Note that the wasm-pack tutorial recommends using the wee_alloc crate. This crate is unmaintained and leaks memory, so it should be avoided. Remove this crate, the default allocator works just fine in WebAssembly.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • vite

    Next generation frontend tooling. It's fast!

  • Now about the choice of the bundler: I don't like webpack and use vite instead. It is blazingly fast, and it requires very little configuration. Getting things like TypeScript, SCSS or React to work correctly and using source maps or hot reloading is a PITA with webpack, whereas it Just Works in vite.

  • trunk

    Build, bundle & ship your Rust WASM application to the web.

  • The alternative to wasm-pack is trunk. I've never used it, so I can't tell you how good it is.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts