From 1831ec8c5aef26df32c818f211abc6a08726a8b5 Mon Sep 17 00:00:00 2001 From: Ramirisu Date: Wed, 18 Sep 2024 18:11:11 +0800 Subject: [PATCH] Build wasm with custom profile to make binary smaller. --- .github/workflows/deploy_github_page.yml | 4 ++-- Cargo.toml | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy_github_page.yml b/.github/workflows/deploy_github_page.yml index f443ef3..0fe3cff 100644 --- a/.github/workflows/deploy_github_page.yml +++ b/.github/workflows/deploy_github_page.yml @@ -23,8 +23,8 @@ jobs: - name: Build run: | - cargo build --release --target wasm32-unknown-unknown - wasm-bindgen --no-typescript --target web --out-dir ./dist/tetris --out-name "tetris" ./target/wasm32-unknown-unknown/release/tetris.wasm + cargo build --profile wasm-release --target wasm32-unknown-unknown + wasm-bindgen --no-typescript --target web --out-dir ./dist/tetris --out-name "tetris" ./target/wasm32-unknown-unknown/wasm-release/tetris.wasm - name: Copy Assets run: | diff --git a/Cargo.toml b/Cargo.toml index 354dfba..c91fd4e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,3 +15,8 @@ log = { version = "*", features = [ "max_level_debug", "release_max_level_warn", ] } + +[profile.wasm-release] +inherits = "release" +opt-level = "s" +strip = "debuginfo"