could not import syscall/js (cannot find package "syscall/js" in GOROOT)

发表于 阅读 6

编写wasm时在vscode中引入syscall/js会报如下错误:

could not import syscall/js (cannot find package "syscall/js" in GOROOT)

https://file.vwood.xyz/2024/07/06/upload_fg6dqacgcrxd76dow74h5jbsztrs6yep.png

vscode的settings中添加上如下配置即可:

{
    "go.toolsEnvVars": {
        "GOOS": "js",
        "GOARCH": "wasm"
    }
}
相关文章