diff --git a/Cargo.toml b/Cargo.toml index f9455aed3..9c6e6e9d4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -45,6 +45,9 @@ wasm-opt = ['-Oz', '-g'] # Tell cargo to run `rustc` with `-C debuginfo=2` - ie, to include debug symbols. # https://doc.rust-lang.org/cargo/reference/profiles.html#debug debug = true +# Tell cargo to run `rustc` with `-Oz` - ie, to optimize for size. +# https://doc.rust-lang.org/cargo/reference/profiles.html#opt-level +opt-level = 'z' [lib] crate-type = ["cdylib"] diff --git a/scripts/build.sh b/scripts/build.sh index 72b92b7e7..d0036524c 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -16,7 +16,7 @@ set -e 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[@]}" +wasm-pack build --target nodejs --scope matrix-org --out-dir pkg --weak-refs "${WASM_PACK_ARGS[@]}" # Convert the Wasm into a JS file that exports the base64'ed Wasm. {