You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My app requires spawning a local web server at http://localhost:8080 to function (both for development and production).
Despite setting http://localhost:8080 as the distDir, devPath, and main window URL, the tauri context is not injected when the window is open (i.e. window.__TAURI__ is undefined).
Tauri cannot really do this, we can't inject APIs into apps we don't control/own (doing so would require us to inject code into safari, chrome, firefox etc.).
The Tauri APIs are only available in windows created by Tauri. This is both a feature and fact of life.
(Setting the distDir option to anything else than a local path will not work either)
We do offer a workaround for this though: https://github.com/tauri-apps/tauri-invoke-http
It spawns a localhost server from Rust that can interface with the command system. You can then use fetch to issue commands.
That said it's not very polished or documented yet.
Describe the bug
My app requires spawning a local web server at
http://localhost:8080
to function (both for development and production).Despite setting
http://localhost:8080
as thedistDir
,devPath
, and main window URL, the tauri context is not injected when the window is open (i.e.window.__TAURI__
is undefined).Reproduction
See minimal repro and steps here: https://github.com/cup-dev/tauri-webserver-issue
Expected behavior
I would expect an ability to spawn a local web server as part of my Tauri app and have the Tauri context available within.
Platform and versions
Stack trace
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: