Compiling and running WebAssembly code
Wasm as a compilation target
But don’t despair! We don’t need to learn to write WebAssembly Text in order to create Wasm code. In fact, WebAssembly wasn’t really designed to be created in this way. It was designed to be a portable compilation target for higher-level languages.
Languages that compile to .wasm
Having other programming languages compile to binary code that can be ran in the browser, and has access to Web Platform APIs, is the most appealing feature of this technology, and why it is so successful. It means that developers that were restricted to writing server-side only code, can now run their code in the client.
- C# and .NET
There are non-browser scenarios where
.wasm code is potentially executable, that we will describe in the next page.
I will try to keep this list up to date as much as possible, but you can also visit Fermyon’s site where for sure they keep much better track.
Wasm compilation toolchains
What makes it possible for languages to compile to Wasm, is called the toolchain that supports conformance with the target language.
It basically includes
cargo, which is the default Rust CLI,
npm for dependency management and
wasm-pack to do the transformation to binary.