tauri-apps / tauri-apps/plugins-workspace

`tauri_plugin_localhost` doesn't work in dev mode

Open
#2,891 0 comments 0 reactions 0 assignees View on GitHub
plugin: localhost type: bug
Dominant language
Rust
Stars
1.8k
Forks
602
Avg merge
4d 14h
Merged PRs (30d)
9

Description

When running `npm run tauri dev` on linux and using the `tauri_plugin_localhost` example code, nothing loads in the localhost-served window. However, this works correctly in a fully built binary.

This appears to be because, unlike when the app is fully built, the path `/` does not resolve to `/index.html`.

Adding

```
let path = if path == "/" {
"/index.html".to_string()
} else {
path
};
```
after https://github.com/tauri-apps/plugins-workspace/blob/fe23a5e01399a6ad61426bf8a94a6bb97227cf88/plugins/localhost/src/lib.rs#L90 appears to serve files that have been already built with `vite build`, but I am not sure how to forward the files from vite's dev server.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.