-
-
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
fix: appType mpa #9865
fix: appType mpa #9865
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,9 @@ import history from 'connect-history-api-fallback' | |
import type { Connect } from 'types/connect' | ||
import { createDebugger } from '../../utils' | ||
|
||
export function spaFallbackMiddleware( | ||
root: string | ||
export function rewriteUrlMiddleware( | ||
root: string, | ||
spaFallback: boolean | ||
): Connect.NextHandleFunction { | ||
const historySpaFallbackMiddleware = history({ | ||
logger: createDebugger('vite:spa-fallback'), | ||
Comment on lines
11
to
12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps we want to change the names here too. |
||
|
@@ -20,7 +21,9 @@ export function spaFallbackMiddleware( | |
if (fs.existsSync(path.join(root, rewritten))) { | ||
return rewritten | ||
} else { | ||
return `/index.html` | ||
if (spaFallback) { | ||
return `/index.html` | ||
} | ||
} | ||
} | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Few lines below we have:
so technically we're still preserving the old function name (so someone can remove it). If There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oh, I didn't see that the name was not yet changed. Yes, I think we should rename it to |
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just me being really nitpicky, but I feel like
htmlFallbackMiddleware
better reflects its usecase 🤔