diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 85399b8..e34a6bc 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -35,6 +35,9 @@ jobs: --out-dir ../../pkg \ --out-name libveritas + - name: Report WASM size + run: ls -lh pkg/libveritas_bg.wasm + - name: Add Node.js wrapper run: cp bindings/wasm/node.js pkg/node.js diff --git a/Cargo.toml b/Cargo.toml index 1011cb1..e37d3ad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,4 +28,8 @@ spacedb = { version = "0.1", default-features = false, features = ["ext opt-level = 3 [profile.release] -lto = true +lto = "fat" +opt-level = "z" +codegen-units = 1 +panic = "abort" +strip = true diff --git a/bindings/wasm/Cargo.toml b/bindings/wasm/Cargo.toml index 6d6edf8..231c076 100644 --- a/bindings/wasm/Cargo.toml +++ b/bindings/wasm/Cargo.toml @@ -19,3 +19,7 @@ spaces_nums = { workspace = true } [dev-dependencies] wasm-bindgen-test = "0.3" + +[package.metadata.wasm-pack.profile.release] +# Pass --enable-bulk-memory so newer rustc output validates, and -Oz for size. +wasm-opt = ["-Oz", "--enable-bulk-memory", "--enable-mutable-globals", "--enable-sign-ext", "--enable-nontrapping-float-to-int"]