Skip to content

Commit

Permalink
Generate smaller code by combining wit-bindgen, wasm-bindgen and wasm…
Browse files Browse the repository at this point in the history
…-opt
  • Loading branch information
fabricedesre committed Aug 26, 2022
1 parent 3839f70 commit 2d13456
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,17 @@ mv *.js static/

cargo build --release --target=wasm32-unknown-unknown

wasm-opt target/wasm32-unknown-unknown/release/qrdecoder.wasm \
-O4 -o static/qrdecoder.wasm \
--remove-imports
wasm-bindgen \
--target web \
--out-dir static \
target/wasm32-unknown-unknown/release/qrdecoder.wasm

wasm-opt static/qrdecoder_bg.wasm \
-O4 -o static/qrdecoder.wasm

rm static/*.d.ts
rm static/qrdecoder.js # wasm-bindgen generated that we don't need.
rm static/qrdecoder_bg.wasm

mv static/qrdecoder-module.js static/qrdecoder_module.js
cp static/* ../nutria/apps/camera/qrdecoder/
Expand Down

0 comments on commit 2d13456

Please sign in to comment.