From the TinyGo docs, it’s as simple as
GOOS=js GOARCH=wasm tinygo build -o wasm.wasm ./main.go
It relies on LLVM’s Wasm backend and some JS glue libraries for the browser.