From b9920ab477664bce5e72ad1e1a41bbfda2d5bc71 Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Tue, 2 May 2023 11:35:44 +0200 Subject: [PATCH] bindings: Fix Wasm conversion into base64 --- bindings/matrix-sdk-crypto-js/scripts/build.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/bindings/matrix-sdk-crypto-js/scripts/build.sh b/bindings/matrix-sdk-crypto-js/scripts/build.sh index f782a2b2e..2c3caeb5f 100755 --- a/bindings/matrix-sdk-crypto-js/scripts/build.sh +++ b/bindings/matrix-sdk-crypto-js/scripts/build.sh @@ -19,7 +19,11 @@ cd $(dirname "$0")/.. RUSTFLAGS='-C opt-level=z' WASM_BINDGEN_WEAKREF=1 wasm-pack build --target nodejs --scope matrix-org --out-dir pkg "${WASM_PACK_ARGS[@]}" # Convert the Wasm into a JS file that exports the base64'ed Wasm. -echo "module.exports = \`$(base64 pkg/matrix_sdk_crypto_js_bg.wasm)\`;" > pkg/matrix_sdk_crypto_js_bg.wasm.js +{ + printf 'module.exports = `' + base64 < pkg/matrix_sdk_crypto_js_bg.wasm + printf '`;' +} > pkg/matrix_sdk_crypto_js_bg.wasm.js # In the JavaScript: # 1. Strip out the lines that load the WASM, and our new epilogue.