Skip to content

Commit 8a7921e

Browse files
authored
fix(core): fallback to index.html on asset loading, closes #2020 #2021 (#2022)
1 parent 70fc87a commit 8a7921e

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"tauri": patch
3+
---
4+
5+
Fallback to `index.html` on asset loading so router with history mode works.

core/tauri/src/manager.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,11 @@ impl<P: Params> WindowManager<P> {
427427

428428
let asset_response = assets
429429
.get(&path)
430+
.or_else(|| {
431+
#[cfg(debug_assertions)]
432+
eprintln!("Asset `{}` not found; fallback to index.html", path); // TODO log::error!
433+
assets.get("index.html")
434+
})
430435
.ok_or(crate::Error::AssetNotFound(path))
431436
.map(Cow::into_owned);
432437
match asset_response {

0 commit comments

Comments
 (0)