diff --git a/README.md b/README.md index febe0492..38975e83 100644 --- a/README.md +++ b/README.md @@ -74,8 +74,9 @@ https://github.com/loro-dev/loro/assets/18425020/ec2d20a3-3d8c-4483-a601-b200243 5. **Rust Target**: Add with `rustup target add wasm32-unknown-unknown`. 6. **wasm-bindgen-cli**: Install version 0.2.86 via `cargo install wasm-bindgen-cli --version 0.2.86`. 6. **wasm-opt**: Install using `cargo install wasm-opt --locked`. -7. **cargo-nextest**: Install using `cargo install cargo-nextest --locked`. -8. **cargo-fuzz**: Run `cargo install cargo-fuzz`. +7. **wasm-snip**: Install using `cargo install wasm-snip`. +8. **cargo-nextest**: Install using `cargo install cargo-nextest --locked`. +9. **cargo-fuzz**: Run `cargo install cargo-fuzz`. ### Test diff --git a/crates/loro-wasm/.cargo/config.toml b/crates/loro-wasm/.cargo/config.toml index 8d711e80..31af7dff 100644 --- a/crates/loro-wasm/.cargo/config.toml +++ b/crates/loro-wasm/.cargo/config.toml @@ -1,5 +1,5 @@ [profile.release] lto = true opt-level = "s" -debug = false +debug = true codegen-units = 1 diff --git a/crates/loro-wasm/scripts/build.ts b/crates/loro-wasm/scripts/build.ts index 069a7306..4a35c124 100644 --- a/crates/loro-wasm/scripts/build.ts +++ b/crates/loro-wasm/scripts/build.ts @@ -37,6 +37,10 @@ async function build() { if (profile !== "dev") { await Promise.all( TARGETS.map(async (target) => { + // --snip-rust-panicking-code --snip-rust-fmt-code + const snip = `wasm-snip ./${target}/loro_wasm_bg.wasm -o ./${target}/loro_wasm_bg.wasm`; + console.log(">", snip); + await Deno.run({ cmd: snip.split(" "), cwd: LoroWasmDir }).status(); const cmd = `wasm-opt -Os ./${target}/loro_wasm_bg.wasm -o ./${target}/loro_wasm_bg.wasm`; console.log(">", cmd); await Deno.run({ cmd: cmd.split(" "), cwd: LoroWasmDir }).status();