WebAssembly promises a whole new kind of web—snappier performance for users, and more flexibility for developers. Instead of being locked into using JavaScript as the sole language for client-side web interaction, a developer can choose from a broad range of other languages—C, TypeScript, Rust, Ruby, Python—and work in the one they’re most comfortable with.
Originally, the only way to create WebAssembly (or WASM for short) was to compile C/C++ code to WebAssembly using the Emscripten toolchain. Today, not only do developers have more language options, but it has become easier to compile these other languages directly to WebAssembly, with fewer intervening steps.
In this piece, we’ll examine the steps required to implement WebAssembly components in a web app. Because WebAssembly is a work-in-progress, the steps are highly dependent on which language you use, and the toolchain is likely to keep changing for some time. But right now, it’s possible to write and deploy useful, if minimal, WebAssembly applications in a number of languages.
Choose a WebAssembly supported language
The first step toward deploying a WebAssembly application is to choose a language that can compile to WebAssembly as a target. There is a good chance that at least one of the major languages you’re using in production can be converted to WebAssembly, or has a compiler that can emit WebAssembly.