/kotlin-wasm-cm-experiments

Experiments with running Kotlin/Wasm with Component Model

Primary LanguageKotlinApache License 2.0Apache-2.0

Experiments with compiling Kotlin to Wasm Component, linking it with an example component written in Rust, transpiling it to JS + Core Wasm using jco, and running the result in Node.js.

Install dependencies

Checkout skuzmich/cm-prototype branch of Kotlin somewhere and install it to mavenLocal:

cd path/to/kotlin
./gradlew install --parallel

Install recent Rust toolchain and add wasm32-unknown-unknown target:

rustup target add wasm32-unknown-unknown

Install wasm-tools

cargo install wasm-tools

Install Node.js v22+ with WasmGC support, for example via NVM:

nvm install v22.2.0

Install jco and preview2-shim

npm install

Install the latest experimental wit-bindgen CLI with Kotlin support via cargo:

cargo install wit-bindgen-cli --git https://github.com/skuzmich/wit-bindgen --branch kotlin

Build and run

./run.sh