| Crates.io | wasm-slim |
| lib.rs | wasm-slim |
| version | 0.1.0 |
| created_at | 2025-11-09 12:58:51.254248+00 |
| updated_at | 2025-11-09 12:58:51.254248+00 |
| description | WASM bundle size optimizer |
| homepage | https://github.com/vitalratel/wasm-slim |
| repository | https://github.com/vitalratel/wasm-slim |
| max_upload_size | |
| id | 1924108 |
| size | 1,260,422 |
Rust CLI tool for automated WASM binary size optimization
Reduce WASM bundle sizes by 60%+ without requiring deep optimization expertise.
Before:
# Manual optimization (complex, error-prone)
cargo build --release
wasm-bindgen ...
wasm-opt -Oz ...
wasm-snip ...
# Result: Maybe 500KB โ 200KB if you know what you're doing
After:
cargo wasm-slim build
# Output: 60% size reduction, zero config โจ
Built on production learnings from real-world WASM optimization projects:
For maximum size reduction, use nightly Rust with the build-std feature:
# Switch to nightly toolchain
rustup default nightly
# Build with automatic build-std configuration
cargo wasm-slim build
What is build-std?
panic_immediate_abort feature (eliminates panic infrastructure)How it works:
wasm-slim detects your nightly toolchain automatically.cargo/config.toml with optimal build-std settingsRequirements:
rustup default nightly)Note: On stable Rust, wasm-slim will provide a tip about nightly benefits.
cargo install wasm-slim
git clone https://github.com/vitalratel/wasm-slim.git
cd wasm-slim
cargo install --path .
The examples/ directory contains production-tested scripts and workflows:
See examples/README.md for details.
Required:
cargo (comes with Rust)For full integration tests:
# Install WASM target
rustup target add wasm32-unknown-unknown
# Install wasm-bindgen-cli (required for build integration tests)
cargo install wasm-bindgen-cli
Note: Unit tests (~355 tests) run without any additional tools. Integration tests that exercise the build pipeline will skip gracefully if wasm-bindgen-cli is not installed.
# Run all tests (unit + integration, some may skip without tools)
cargo test
# Run only unit tests (no external tools required)
cargo test --lib
# Run integration tests (requires wasm-bindgen-cli)
cargo test --test integration_tests
# Run with coverage
cargo install cargo-llvm-cov
cargo llvm-cov --html
wasm-bindgen-cli for full pipeline testingIntegration tests will display a helpful message if tools are missing:
โ ๏ธ Skipping test: wasm-bindgen-cli not found in PATH
Install with: cargo install wasm-bindgen-cli
Contributions are welcome! See CONTRIBUTING.md for guidelines.
Ways to contribute:
MIT License - see LICENSE file for details
Issues and questions: GitHub Issues
Version: 0.1.0 (Pre-1.0 - API may change)