Split up Wasm binaries so Cloudflare deployments stay below 25 MB per file

This commit is contained in:
Keavon Chambers
2026-07-14 14:43:34 -07:00
parent 97f8113fe4
commit 97a43e66fb
6 changed files with 90 additions and 7 deletions

View File

@@ -70,9 +70,9 @@ pub fn build_wasm_steps(release: bool, native: bool) -> Vec<Expression> {
if release {
let wasm_file = pkg_dir.join(format!("{OUT_NAME}_bg.wasm"));
// `-Oz` (size over speed) keeps us under Cloudflare Pages' 25 MiB single-file cap.
// `-g` preserves the name section, which the panic hook reads at runtime to spot node-graph panics (see wrapper `lib.rs`).
steps.push(cmd!("wasm-opt", "-Oz", "-g", &wasm_file, "-o", &wasm_file));
// `-O3` favors runtime speed over binary size and `-g` preserves the name section,
// which the panic hook reads at runtime to spot node-graph panics (see wrapper `lib.rs`).
steps.push(cmd!("wasm-opt", "-O3", "-g", &wasm_file, "-o", &wasm_file));
}
steps