tauri-apps / tauri

Build smaller, faster, and more secure desktop applications with a web frontend.
https://tauri.app
Apache License 2.0
81.93k stars 2.46k forks source link

How to redirect React route after tauri2 packaging #10931

Open poohlaha opened 1 week ago

poohlaha commented 1 week ago

Development environment: Tauri2, React18 Machine: macOS Sonoma 14.0

Now start packaging, use Webpack to package React, need to use theproduction environment, The front-end packaging results are as follows:

image

Then execute the application packaging:

pnpm tauri build --bundles app

After packaging, open the application and click the link on the page to jump to the route, but you cannot jump to the corresponding page。

How to redirect a SPA (single page application) like this? If the front-end project is deployed directly to the server, nginx or something like that is used for redirection. How to do it with tauri2 here?

FabianLars commented 1 week ago

Can you expand a bit on what you're trying? Or maybe share a minimal reproduction? Generally Tauri is spa/router compatible, for example i've used plain old react-router for years just fine.