mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 22:53:14 -04:00
Use wasm-opt when compiling for web
This commit is contained in:
@@ -22,3 +22,5 @@ egui_web = { path = 'egui_web' }
|
||||
# opt-level = 1 # very slow and big wasm. Don't do this.
|
||||
opt-level = 2 # fast and small wasm, basically same as `opt-level = 's'`
|
||||
# opt-level = 3 # unecessarily large wasm for no performance gain
|
||||
|
||||
# debug = true # include debug symbols, useful when profiling wasm
|
||||
|
||||
@@ -30,8 +30,11 @@ wasm-bindgen "target/wasm32-unknown-unknown/$BUILD/$TARGET_NAME" \
|
||||
--out-dir docs --no-modules --no-typescript
|
||||
|
||||
# brew install wabt # to get wasm-strip
|
||||
wasm-strip docs/${CRATE_NAME}_bg.wasm
|
||||
# wasm-strip docs/${CRATE_NAME}_bg.wasm
|
||||
|
||||
echo "Finished: docs/${CRATE_NAME}_bg.wasm"
|
||||
echo "Optimizing wasm…"
|
||||
# brew install binaryen # to get wasm-opt
|
||||
wasm-opt docs/egui_demo_app_bg.wasm -O2 --fast-math -o docs/egui_demo_app_bg.wasm # add -g to get debug symbols
|
||||
echo "Finished docs/${CRATE_NAME}_bg.wasm"
|
||||
|
||||
open http://localhost:8888/index.html
|
||||
|
||||
Reference in New Issue
Block a user