-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nested path behaviour issue, including for multiple entry points #10487
Comments
Having the same problem using the nested apps. Page refresh always returns the top app's index.html, even though subfolders containing nested apps have their own index.html. It would be great if Vite.js could provide this functionality at least via plugin. Thank you! |
I am facing some issue with mulitple html file app. Has anyone find a solution for this yet?
|
I think this is the same as #2958. You need a Otherwise you can inject a custom middleware (similar solutions in the linked PR) to support your usecase. |
Describe the bug
I'm currently using multiple entry points:
Whenever I navigate somewhere beneath the applications root, for example
https://my.dev.server/Login/client-side-route
, I end up with a 404.Reproduction
https://stackblitz.com/edit/vitejs-vite-r5hbbj?file=src/Login/App.tsx
Steps to reproduce
Using the reproduction, you need only navigate to
https://vitejs-vite-r5hbbj--5173.local.webcontainer.io/Login/nested-route
.My expectation was that the vite development server would walk the paths upwards, overlapped with the
root
configuration option until it fins a suitableindex.html
. Then it would serve that file with a status of 200 while preserving the path. Thus allowing client side routing to kick in.Let's pretend this URL was used:
https://vitejs-vite-r5hbbj--5173.local.webcontainer.io/Login/nested-route-1/nested-route-2/nested-route-3
:/Login/nested-route-1/nested-route-2/nested-route-3
👉 ⛔src/Login/nested-route-1/nested-route-2/nested-route-3/index.html
, which doesn't exist/Login/nested-route-1/nested-route-2/
👉 ⛔src/Login/nested-route-1/nested-route-2/index.html
, which doesn't exist/Login/nested-route-1/
👉 ⛔src/Login/nested-route-1/index.html
, which doesn't exist/Login/
👉 ✔️src/Login/index.html
, which does exist!Using this strategy, vite can serve multiple sites with support for client-side (HTML5) routing! 🎊
System Info
Used Package Manager
yarn
Logs
See repro. 🙂
Validations
The text was updated successfully, but these errors were encountered: