Skip to content

Commit

Permalink
fix(core): fallback to index.html on asset loading, closes #2020 #2021 (
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasfernog authored Jun 20, 2021
1 parent 70fc87a commit 8a7921e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changes/fix-asset-loading-vue-router.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"tauri": patch
---

Fallback to `index.html` on asset loading so router with history mode works.
5 changes: 5 additions & 0 deletions core/tauri/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -427,6 +427,11 @@ impl<P: Params> WindowManager<P> {

let asset_response = assets
.get(&path)
.or_else(|| {
#[cfg(debug_assertions)]
eprintln!("Asset `{}` not found; fallback to index.html", path); // TODO log::error!
assets.get("index.html")
})
.ok_or(crate::Error::AssetNotFound(path))
.map(Cow::into_owned);
match asset_response {
Expand Down

0 comments on commit 8a7921e

Please sign in to comment.