Skip to main content

Examples overview

Each example here is a complete project: the setup steps, the config files, and working Rust and JavaScript you can run. Pick the one that matches your build tool.

Web applications​

Backend and CLI applications​

  • Node.js Webpack - server-side applications using Webpack.
  • Bun - the Bun runtime, wired through a preload plugin.
  • esbuild - fast bundling for Node.js or the browser using the esbuild plugin.
  • Rspack - Rust-based bundling with the Webpack-compatible loader, unchanged.
  • Rollup - bundling for Node.js or the browser using the Rollup plugin.
  • Vite - SSR and client builds using the Vite plugin (the node strategy for the server, web for the client).

Full-stack frameworks​

  • Next.js - App Router with the withRustWasm helper. The same .rs works from Server Components, Client Components, and Edge routes (the node strategy for the server, web for the client, and a pre-compiled module on Edge), under both Turbopack and webpack.

Desktop applications​

  • Electron - main and renderer processes with Webpack (electron-main uses the node strategy, electron-renderer uses web), with the wasm bytes inlined into both.

TypeScript​

  • TypeScript types - type .rs imports with the ambient floor, the gen-types CLI, the build-time types option, and the editor Language Service plugin.