(module
(import "env" "greet" (func $greet))
(func
;; call the greet function
call $greet
)
(start 1) ;; run the first function automatically
)
const url = '{%wasm-url%}';
await WebAssembly.instantiateStreaming(fetch(url), {
env: {
greet: function () {
console.log('Hello');
// Expected output: "Hello"
},
},
});