From 8a7921e5cbcbecea16d4ad4a29ef05d984ad3110 Mon Sep 17 00:00:00 2001 From: Lucas Fernandes Nogueira Date: Sun, 20 Jun 2021 11:47:15 -0300 Subject: [PATCH] fix(core): fallback to index.html on asset loading, closes #2020 #2021 (#2022) --- .changes/fix-asset-loading-vue-router.md | 5 +++++ core/tauri/src/manager.rs | 5 +++++ 2 files changed, 10 insertions(+) create mode 100644 .changes/fix-asset-loading-vue-router.md diff --git a/.changes/fix-asset-loading-vue-router.md b/.changes/fix-asset-loading-vue-router.md new file mode 100644 index 000000000..c59c745d2 --- /dev/null +++ b/.changes/fix-asset-loading-vue-router.md @@ -0,0 +1,5 @@ +--- +"tauri": patch +--- + +Fallback to `index.html` on asset loading so router with history mode works. diff --git a/core/tauri/src/manager.rs b/core/tauri/src/manager.rs index 070e7df5f..0485046a4 100644 --- a/core/tauri/src/manager.rs +++ b/core/tauri/src/manager.rs @@ -427,6 +427,11 @@ impl WindowManager

{ 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 {