-
-
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
feat: spa option, preview
and dev
for MPA and SSR apps
#8217
Conversation
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
93a18ad
to
e7fc218
Compare
A bit nitpicking here, I personally don't feel the |
We talked about the PR in today's team meeting. We're worried about making Vite preview ever more complex to accommodate future requirements from users like vite-plugin-ssr. We still think that a |
I've updated the PR and I believe it resolves all discussions. I've refactored how we document this: the documentation now lives under
This is somewhat documented at https://vitejs.dev/guide/ssr.html#setting-up-the-dev-server and since the docs now live on that same page, I believe it's enough.
I agree and this is actually what this PR is about: getting Vite's internal SPA assumptions out of the way in order to uncouple Vite from user middlewares. Telefunc now also adds its RPC middleware to the development and preview servers and it works. I believe that, after this PR, things will be flexible enough to accommodate for all kinds of needs. Some minor tweaks may be needed, but nothing fundamental AFAICT. And, yes, for unreasonable requirements we can answer: write your own CLI. |
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
40d275e
to
a4c2c16
Compare
a4c2c16
to
70b9e41
Compare
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
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.
Awesome! Thanks for driving this and seeing it through. I'm really excited about it!
Alright, I've applied all suggestions. Let me know if I missed something. Also feel free to directly push to the PR.
I'm glad you're excited about this. Thank you both for your helpful reviews. |
Co-authored-by: Ben McCann <322311+benmccann@users.noreply.github.com>
$ vite preview
and $ vite dev
for MPA and SSR appspreview
and dev
for MPA and SSR apps
This will likely by superseded by #8438. |
Description
This fixes
$ vite preview
and$ vite dev
for SSR and MPA apps.This PR enables users and frameworks to set
config.isSPA = false
to disable SPA catch-all routing.It supersedes these previous PRs:
$ vite preview
404 handling #7665And fixes these issues:
index.html
that are incompatible with SSR #7631Additional context
I decided against
config.appType: spa | ssr | mpa
because many frameworks blur the line betweenssr
andmpa
. For example, vite-plugin-ssr 0.4 allows the user to implement SSR as well as MPA apps. It also allows the user to have one SSR page while the rest is MPA; it's then not clear whether the app type isssr
ormpa
. Many other frameworks, such as Nuxt, also blur the line between SSR and MPA.Thus I believe having only two modes "SPA" or "not SPA" is the way to go.
I'm fairly confident this PR is in a good state
and can be merged as-ison a high-level (edit). (But happy to be shown wrong.)What is the purpose of this pull request?
Before submitting the PR, please make sure you do the following
fixes #123
).