Skip to content

Commit e64bdf6

Browse files
committed
fix(app): reject release builds without custom-protocol
Adds a compile_error guard so a release build that omits the custom-protocol feature fails at compile time instead of producing a binary whose webview loads the Vite dev server (devUrl http://localhost:5173) and shows ERR_CONNECTION_REFUSED. This is the root cause of the packaged app failing to load.
1 parent 1b3c6b0 commit e64bdf6

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

app/src-tauri/src/lib.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,22 @@
88
//! * persistent settings + per-app profiles,
99
//! * the auto-dim engine.
1010
11+
// Production safety guard. Tauri selects the frontend source at compile time as
12+
// `dev = !custom_protocol`. A release build that omits the `custom-protocol`
13+
// feature therefore points the webview at the Vite dev server
14+
// (devUrl http://localhost:5173) instead of embedding `app/dist`, so the
15+
// packaged app starts with ERR_CONNECTION_REFUSED. Fail loudly here rather than
16+
// silently shipping a broken binary. Build with `cargo tauri build`, the
17+
// `cargo app-release` alias, or
18+
// `cargo build --release -p monitor-brightness-control --features custom-protocol`.
19+
#[cfg(all(not(debug_assertions), not(feature = "custom-protocol")))]
20+
compile_error!(
21+
"release builds require the `custom-protocol` feature; without it the Tauri webview \
22+
loads the Vite dev server (devUrl http://localhost:5173) and the app shows \
23+
ERR_CONNECTION_REFUSED. Build with `cargo tauri build`, `cargo app-release`, or \
24+
`cargo build --release -p monitor-brightness-control --features custom-protocol`."
25+
);
26+
1127
mod admin_autostart;
1228
mod auto_dim;
1329
mod commands;

0 commit comments

Comments
 (0)