What is the maximum allowed size of a WebAssembly module?

ExpertTip

#1

Scripts are limited to 1MB in size, but what about WebAssembly modules?

Question originally asked here Native Golang Support for Workers


Native Golang Support for Workers
#2

The module and script together must be under 1MB after gzip compression. Because we run every customer’s code at every Cloudflare location, it is important that the code stay lean.

Currently, this means that WebAssembly works best with languages that have light runtimes, like C, C++, and Rust. It currently doesn’t work well for languages like Go that ship a garbage collector as part of their runtime. We are working on solutions to that – essentially, we aim to make it possible for multiple applications using the same runtime to share that runtime. This requires improving WebAssembly tooling to support some way to share common libraries – it will take some time.