YrXtals/web/build.rs

18 lines
704 B
Rust

// drops empty placeholders into dist/ if the wasm-pack output is missing, so the server bin compiles standalone via cargo check.
// the real bytes get written by scripts/web/build.sh phase 1 (wasm-pack) right before phase 2 (cargo build) embeds them.
fn main() {
let dist = std::path::Path::new("dist");
let _ = std::fs::create_dir_all(dist);
let path = dist.join("index.html");
if !path.exists() {
let _ = std::fs::write(&path, b"");
println!(
"cargo:warning=missing {}, wrote empty placeholder. run scripts/web/build.sh to produce the real bundle.",
path.display()
);
}
println!("cargo:rerun-if-changed={}", path.display());
}