wip
This commit is contained in:
21
playground/wasm/build.sh
Executable file
21
playground/wasm/build.sh
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
OUT_DIR="$SCRIPT_DIR/../static"
|
||||
OUT_WASM="$OUT_DIR/main.wasm"
|
||||
|
||||
mkdir -p "$OUT_DIR"
|
||||
|
||||
tinygo build -target=wasm -opt=z -no-debug -panic=trap -gc=leaking \
|
||||
-o "$OUT_WASM" "$SCRIPT_DIR"
|
||||
|
||||
# Optional post-process (run only if tools exist)
|
||||
# command -v wasm-opt >/dev/null && wasm-opt -Oz --strip-debug --strip-dwarf --strip-producers \
|
||||
# -o "$OUT_WASM.tmp" "$OUT_WASM" && mv "$OUT_WASM.tmp" "$OUT_WASM"
|
||||
# command -v wasm-strip >/dev/null && wasm-strip "$OUT_WASM"
|
||||
# command -v brotli >/dev/null && brotli -f -q 11 "$OUT_WASM" -o "$OUT_WASM.br"
|
||||
# command -v gzip >/dev/null && gzip -c -9 "$OUT_WASM" > "$OUT_WASM.gz"
|
||||
|
||||
# Copy TinyGo runtime
|
||||
cp -f "$(tinygo env TINYGOROOT)/targets/wasm_exec.js" "$OUT_DIR/wasm_exec.js"
|
Reference in New Issue
Block a user