Skip to content

Commit

Permalink
Merge pull request #898 from polywrap/wasm-snip-reduce-size-rust
Browse files Browse the repository at this point in the history
Reduce Rust Wasm Module Size By 85% (wasm-snip)
  • Loading branch information
dOrgJelli authored Jun 3, 2022
2 parents f9afb16 + 4698812 commit 67b119b
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ RUN curl -L https://github.com/WebAssembly/binaryen/releases/download/version_10
# Install the toml-cli
RUN cargo install toml-cli

# Install wasm-snip
RUN cargo install wasm-snip

{{#web3api_linked_packages.length}}
WORKDIR /linked-packages
{{/web3api_linked_packages.length}}
Expand Down Expand Up @@ -105,5 +108,7 @@ RUN mkdir ./build
# Use wasm-opt to perform the "asyncify" post-processing step over all modules
{{#web3api_modules}}
RUN WASM_MODULE=$(ls ./{{dir}}/target/wasm32-unknown-unknown/release/*.wasm); \
wasm-opt --asyncify -O2 $WASM_MODULE -o ./build/{{name}}.wasm
wasm-snip $WASM_MODULE -o ./build/snipped_{{name}}.wasm && \
wasm-opt --asyncify -Os ./build/snipped_{{name}}.wasm -o ./build/{{name}}.wasm && \
rm -rf ./build/snipped_{{name}}.wasm
{{/web3api_modules}}

0 comments on commit 67b119b

Please sign in to comment.