Simplest configuration for a Rust + React + Typescript project?

I'm working on a project which uses Rust for some of the core business logic that gets compiled to WebAssembly using wasm-pack and has a ReactJS frontend written in TypeScript.

Has anyone found a simple setup for building the frontend and being able to import WebAssembly code?

I normally use Parcel when developing anything in the browser because it Just Works out of the box without needing to install half a dozen plugins and write hundreds of lines of configuration code, but the Parcel 2 rewrite doesn't yet support WebAssembly.

In my case, the rust-webpack-template template the wasm-pack documentation points to isn't sufficient because the JavaScript code just acts as a trampoline to load the WebAssembly and call its start() function. It doesn't really show you how you would import types and functions from your WebAssembly module and use them in a normal web app.

1 Like