Fix Wasm Edge Function Docs (#33910)

* fixed docs bug: when importing wasm, you need to include the js and use this. Otherwise, there will be wasm instantiate errors

* Update wasm.mdx

Got rid of filename on top of markdown

* Update index.ts

got rid of filename comment at the top
This commit is contained in:
Eric Kharitonashvili authored and GitHub committed 2025-02-28 10:43:58 -05:00
1 parent 342c9c4112
commit 00dfbdca0a
2 files changed
+2 -9

No files matched your search

+1 -1
View File
@@ -77,7 +77,7 @@ Before deploying the Edge Function, we need to ensure it bundles the Wasm module
```toml
[functions.wasm-add]
static_files = [ "./functions/wasm-add/add-wasm/pkg/*.wasm"]
static_files = [ "./functions/wasm-add/add-wasm/pkg/*"]
```
Deploy the function by running:
@@ -1,11 +1,4 @@
const wasmBuffer = await Deno.readFile(
new URL("./add-wasm/pkg/add_wasm_bg.wasm", import.meta.url),
);
const { instance } = await WebAssembly.instantiate(
wasmBuffer,
);
const { add } = instance.exports;
import { add } from "./add-wasm/pkg/add_wasm.js";
Deno.serve(async (req) => {
const { a, b } = await req.json();