-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
feat: support serving index.html
in middleware mode
#2871
feat: support serving index.html
in middleware mode
#2871
Conversation
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.
@meowtec we discussed this with Evan and this feature is approved. About the config API, we think that we should avoid the complexity of an object here.
Let's use proposal at #2871 (comment)
middlewareMode: 'html' | 'ssr' | true
Let's also update the documentation to use 'ssr'
instead of true
when explaining how to configure SSR.
Thanks for the work on this PR
d5c3334
to
03f9e09
Compare
03f9e09
to
b811741
Compare
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.
Looks like server.middlewareMode
is not documented yet in https://vitejs.dev/config/#server-options. You may also want to include that in this PR or we can do it later. We may also need to think about how to add a test for 'html' mode to avoid future regressions.
document added |
* feat: support for serving `index.html` in middleware mode * docs: document `server.middlewareMode`
Description
I want to integrate vite (as a koa middleware) to my koa app for just development.
When
middlewareMode
enabled, vite will not handle the html request. I should serve them like this: Setting Up the Dev ServerI am not working on SSR, and I do not like to serve the html content by myself. Instead, the internal html middleware is enough for me.
It should be able to use
indexHtmlMiddleware
andspa fallback
even whenmiddlewareMode
enabled.Additional context
What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).