Copy/pasted from the purescript-native wiki:
There’s not much to it. Instead of building a regular executable with
$ spago build -- -g corefn && psgo
you add a couple of Go environment variables:
$ spago build -- -g corefn && GOOS=js GOARCH=wasm GOFLAGS=-o=main.wasm psgo
You can then test it using the instructions from the relevant section of the Go wiki.
See the Go wiki section on WebAssembly for more information.