Fix wasm2js example (#2837)

Co-authored-by: ambiso <ambiso@invalid>
This commit is contained in:
ambiso 2022-03-16 16:30:49 +01:00 committed by GitHub
parent a1520c4e5d
commit 7993d911f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View File

@ -3,12 +3,13 @@
set -ex
# Compile our wasm module and run `wasm-bindgen`
wasm-pack build --target web
wasm-pack build
# Run the `wasm2js` tool from `binaryen`
wasm2js pkg/wasm2js_bg.wasm -o pkg/wasm2js_bg.js
wasm2js pkg/wasm2js_bg.wasm -o pkg/wasm2js_bg.wasm.js
# Update our JS shim to require the JS file instead
sed -i 's/wasm2js_bg.wasm/wasm2js_bg.js/' pkg/wasm2js.js
sed -i 's/wasm2js_bg.wasm/wasm2js_bg.wasm.js/' pkg/wasm2js.js
sed -i 's/wasm2js_bg.wasm/wasm2js_bg.wasm.js/' pkg/wasm2js_bg.js
http

View File

@ -1,4 +1,4 @@
// Import our JS shim and initialize it, executing the start function when it's
// ready.
import init from './pkg/wasm2js.js';
init();
// Import our JS shim; will initialize by itself
import { run } from './pkg/wasm2js.js';
// Run the function a second time
run();