Setup development environment for Scala.js
To write Golem components in Scala.js, a special version of wit-bindgen
needs to be installed, as well as the sbt
build tool and Node.js and npm
.
Install WebAssembly tooling
First of all, to install wit-bindgen-scalajs
via cargo
, you need to install the latest stable version of Rust. The recommended way to do so is using https://rustup.rs (opens in a new tab):
Install Rust
Install rustup
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Install the latest stable version of Rust
rustup install stable && rustup default stable
Add the WASI target
rustup target add wasm32-wasip1
Install wit-bindgen-scalajs
cargo install --git https://github.com/vigoo/wit-bindgen-scalajs wit-bindgen-cli --locked
Confirm the installation:
wit-bindgen-scalajs --version
wit-bindgen-cli 0.37.0 (f30fdae38 2025-02-23)
Golem requires a specific version of wasm-tools
, and wit-bindgen
. Please make sure the
correct version is installed with the commands described above.
Install Node.js and npm
Install Node.js and npm to your system by following the official instructions (opens in a new tab).
Install sbt
Follow the official instructions (opens in a new tab) to install sbt.