Followed tutorial here: https://github.com/golang/go/wiki/WebAssembly
- install compatible version of golang. Test with go1.12.8
- get cue:
go get -u cuelang.org/go/cue
NOTE: this installs the packages files, not the cmd - get the wasm exec_file
cp "$(go env GOROOT)/misc/wasm/wasm_exec.js
- Build the wasm:
GOARCH=wasm GOOS=js go build -o lib.wasm main.go
-
install
goexec
if needed (or serve the files some other way):go get -u github.com/shurcooL/goexec
-
Serve files:
goexec 'http.ListenAndServe(":8080", http.FileServer(http.Dir(".")))'