Skip to content

Commit

Permalink
fix: fix spa fallback on paths ending with slash
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jan 2, 2021
1 parent a7a5c5b commit 60fe476
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/vite/src/node/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,12 @@ export async function createServer(
{
from: /\/$/,
to({ parsedUrl }: any) {
return parsedUrl.pathname + 'index.html'
const rewritten = parsedUrl.pathname + 'index.html'
if (fs.existsSync(path.join(root, rewritten))) {
return rewritten
} else {
return `/index.html`
}
}
}
]
Expand Down

0 comments on commit 60fe476

Please sign in to comment.