WebAssembly (Wasm) is a binary instruction format for a stack-based virtual machine. This format is platform-independent because it runs on its own virtual machine. Wasm is designed to be fast and secure, and it can compile code from various programming languages, including Kotlin.
Kotlin/Wasm is a new compilation target for Kotlin. You can use it in your Kotlin Multiplatform projects. With Kotlin/Wasm, you can create applications that run on different environments and devices supporting WebAssembly and meeting Kotlin's requirements.
Almost all major browsers already support WebAssembly 1.0. To run applications built with Kotlin/Wasm in a browser, you need to enable an experimental garbage collection feature.
Compose Multiplatform for Web
Compose Multiplatform for Web is based on new Kotlin/Wasm target. You can create a Kotlin Multiplatform project and experiment with sharing your mobile or desktop UIs with the web. With Compose Multiplatform for Web, you can run your code in the browser with all the benefits of WebAssembly.
How to get started
You can use the Kotlin standard library (
stdlib) and test library (
kotlin.test) in Kotlin/Wasm out of the box. The version of these libraries is the same as the version of the
Kotlin/Wasm has an experimental support for other Kotlin libraries. Read more how to enable them in your project.