We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0f3d085 commit 512004eCopy full SHA for 512004e
examples/wasm-plugin/aleph.config.ts
@@ -0,0 +1,18 @@
1
+import { } from "https://deno.land/[email protected]/encoding/base64.ts"
2
+
3
+export default {
4
+ plugins: [{
5
+ test: /.wasm$/,
6
+ transform(content: Uint8Array) {
7
+ return {
8
+ code: `
9
+ const wasmCode = new Uint8Array([${content.join(',')}])
10
+ const wasmModule = new WebAssembly.Module(wasmCode)
11
+ const wasmInstance = new WebAssembly.Instance(wasmModule)
12
+ export default wasmInstance.exports
13
+ `,
14
+ loader: 'js'
15
+ }
16
17
+ }]
18
+}
examples/wasm-plugin/pages/42.wasm
92 Bytes
examples/wasm-plugin/pages/index.tsx
@@ -0,0 +1,8 @@
+import React from 'https://esm.sh/react'
+import wasm from './42.wasm'
+export default function Home() {
+ return (
+ <h1>{wasm.main()}</h1>
+ )
0 commit comments