Running JavaScript in WebAssembly with WasmEdge

[Running JavaScript in WebAssembly with WasmEdge]

[Github: Wasmedge]

[Install and uninstall WasmEdge]

[Build and run a standalone WebAssembly app]

Missing exec_wasm.js

wasmedge ..\wasm\hello.wasm
[2023-11-21 16:12:43.280] [error] instantiation failed: unknown import, Code: 0x62
[2023-11-21 16:12:43.281] [error] When linking module: “gojs” , function name: “runtime.scheduleTimeoutEvent”
[2023-11-21 16:12:43.282] [error] At AST node: import description
[2023-11-21 16:12:43.283] [error] At AST node: import section
[2023-11-21 16:12:43.283] [error] At AST node: module

Try to include exec_wasm.js

wasmedge –dir .:. ../wasm/hello.wasm js/wasm_exec.js WasmEdge Runtime
[2023-11-21 16:18:26.949] [error] instantiation failed: unknown import, Code: 0x62
[2023-11-21 16:18:26.950] [error] When linking module: “gojs” , function name: “runtime.scheduleTimeoutEvent”
[2023-11-21 16:18:26.950] [error] At AST node: import description
[2023-11-21 16:18:26.950] [error] At AST node: import section
[2023-11-21 16:18:26.951] [error] At AST node: module

Wasmer – WebAssembly Runtime

[Wasmer] is a blazing fast and secure WebAssembly runtime that enables incredibly lightweight containers to run anywhere: from Desktop to the Cloud, Edge and even the browser

Install with PowerShell:
iwr https://win.wasmer.io -useb | iex

Install with Scoop:
scoop install wasmer

[Wasmer C API]

[Wasmer Go]

[Cpp_WasmerWebSocketClient]

Issue: [Running golang created WASM with CLI lacks wasm_exec.js bindings]

Wasmer doesn’t have wasm_exec.js implemented yet… [as described by the FAQ]

error: Unable to instantiate the WebAssembly module
╰─▶ 1: Error while importing “gojs”.”runtime.scheduleTimeoutEvent”: unknown import. Expected Function(FunctionType { params: [I32], results: [] })