Os vs Oz, size wise, only is about 100kb difference. but Oz disables some optimizations. Enabling Os instead of Oz brings the binary size up from 876527 bytes to 972775 bytes (a 10.9% increase). Note: I am referring to wasm binary size as that's the main focus of this project
13 lines
461 B
Bash
Executable File
13 lines
461 B
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
wasm-pack build --target web --release --no-typescript
|
|
wasm-opt -Os -o pkg/integral_site_bg_2.wasm pkg/integral_site_bg.wasm
|
|
mv pkg/integral_site_bg_2.wasm pkg/integral_site_bg.wasm
|
|
llvm-strip --strip-all pkg/integral_site_bg.wasm
|
|
|
|
rm -fr tmp | true #delete tmp folder if exists
|
|
mkdir tmp tmp/pkg
|
|
cp -r pkg/integral_site_bg.wasm pkg/integral_site.js tmp/pkg/
|
|
cp www/index.html www/style.css tmp/
|
|
|
|
sed -i 's/\.\.\/pkg/\.\/pkg/g' tmp/index.html |