The syscall/js package has a build constraint. Solution Put this on top of the main file before package / wherever the syscall/js is imported //go:build js && wasm And then build using GOOS=js GOARCH=wasm go build -o main.wasm