diff --git a/server/build.rs b/server/build.rs index 50f5e24..d0f2db8 100644 --- a/server/build.rs +++ b/server/build.rs @@ -29,6 +29,19 @@ fn main() { return; } + // When cross-compiling (e.g. musl via `cross`), the Docker container + // has no Node/pnpm. The release script builds macOS first, so + // frontend/dist/ already exists. Skip the frontend build in that case. + let target = env::var("TARGET").unwrap_or_default(); + let host = env::var("HOST").unwrap_or_default(); + if target != host { + let dist = Path::new("../frontend/dist"); + if !dist.exists() { + panic!("Cross-compiling but frontend/dist/ is missing. Build macOS first."); + } + return; + } + let frontend_dir = Path::new("../frontend"); // Ensure dependencies are installed and build the frontend bundle.