Fix Android insta-crash: don't export TS bindings at runtime
The tauri-specta `.export(...)` call ran inside run() on every debug app start and tried to write `../src/lib/api/bindings.ts`, a path that doesn't exist on a device — `.expect()` panicked at startup, crashing the app instantly on Android. Bindings are generated by the `export_typescript_bindings` test instead.
This commit is contained in:
parent
731966246f
commit
dc1f516da7
@ -586,14 +586,12 @@ pub fn run() {
|
||||
.filter_level(log::LevelFilter::Info)
|
||||
.init();
|
||||
|
||||
// NOTE: TypeScript bindings are generated by the `export_typescript_bindings`
|
||||
// test (`cargo test export_typescript_bindings`), NOT at runtime. Calling
|
||||
// `.export()` here would try to write `../src/lib/api/bindings.ts` at app
|
||||
// startup, which panics on devices (e.g. Android) where that path doesn't exist.
|
||||
let builder = specta_builder();
|
||||
|
||||
// Export TypeScript bindings (types + typed invoke wrappers) in dev builds.
|
||||
#[cfg(debug_assertions)]
|
||||
builder
|
||||
.export(specta_typescript::Typescript::default().bigint(specta_typescript::BigIntExportBehavior::Number), "../src/lib/api/bindings.ts")
|
||||
.expect("Failed to export typescript bindings");
|
||||
|
||||
tauri::Builder::default()
|
||||
.plugin(tauri_plugin_opener::init())
|
||||
.plugin(tauri_plugin_os::init())
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user