feat: spa option, preview and dev for MPA and SSR apps#8217
feat: spa option, preview and dev for MPA and SSR apps#8217patak-cat merged 21 commits intovitejs:mainfrom
preview and dev for MPA and SSR apps#8217Conversation
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>
benmccann
left a comment
There was a problem hiding this comment.
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 previewand$ vite devfor SSR and MPA apps.This PR enables users and frameworks to set
config.isSPA = falseto disable SPA catch-all routing.It supersedes these previous PRs:
$ vite preview404 handling #7665And fixes these issues:
index.htmlthat are incompatible with SSR #7631Additional context
I decided against
config.appType: spa | ssr | mpabecause many frameworks blur the line betweenssrandmpa. 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 isssrormpa. 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).