diff --git a/platform/web/detect.py b/platform/web/detect.py index bf75c2f9fcf..f016d6ff620 100644 --- a/platform/web/detect.py +++ b/platform/web/detect.py @@ -285,6 +285,9 @@ def configure(env: "SConsEnvironment"): env.Append(CCFLAGS=["-sSUPPORT_LONGJMP='wasm'"]) env.Append(LINKFLAGS=["-sSUPPORT_LONGJMP='wasm'"]) + # Run wasm-opt binaryen maximum shrink options + env.Append(LINKFLAGS=["-sBINARYEN_EXTRA_PASSES='-Oz'"]) + # Allow increasing memory buffer size during runtime. This is efficient # when using WebAssembly (in comparison to asm.js) and works well for # us since we don't know requirements at compile-time.