We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
vitejs
Learn more about funding links in repositories.
Report abuse
1 parent 892916d commit 61165f0Copy full SHA for 61165f0
packages/vite/src/node/server/middlewares/htmlFallback.ts
@@ -14,17 +14,15 @@ export function htmlFallbackMiddleware(
14
rewrites: [
15
{
16
from: /\/$/,
17
- to({ parsedUrl }: any) {
+ to({ parsedUrl, request }: any) {
18
const rewritten =
19
decodeURIComponent(parsedUrl.pathname) + 'index.html'
20
21
if (fs.existsSync(path.join(root, rewritten))) {
22
return rewritten
23
- } else {
24
- if (spaFallback) {
25
- return `/index.html`
26
- }
27
}
+
+ return spaFallback ? `/index.html` : request.url
28
29
30
]
0 commit comments