fix: dont remove indexHtmlMiddleware when spa false#8438
fix: dont remove indexHtmlMiddleware when spa false#8438
Conversation
|
This is ok for vite-plugin-ssr but I can see it to be problematic for other SSR frameworks that use Seems like we do need Instead of If we don't foresee another use case for |
|
We decided to go with a global config option because it doesn't affect only the server, it also has implications for preview (maybe later for build optimizations?). So I think that I think we should go back to
|
|
I like making With The |
For reference,
Yes, |
|
Makes sense on a high-level. I'm just a bit worried on a lower level.
Let's imagine we change Vite to make A vite-plugin-ssr MPA user will want to have Anyways, I guess it's fine to go for For additional context: it's tempting to go for a high-level MPA/SSR/SPA setting because that's what the discourse talked about the last couple of years, but technically this may be a dead-end. Maybe I'm wrong though, we'll see. Long story short: I'm 👍 for going with |
|
I'm unclear what we're talking about when we say MPA and why it needs a new option. I know that it stands for multi-page app and I guess it's not doing SSR, but why does it affect anything on the server? Shouldn't it just affect whether navigation on the client is done via I was assuming SPA rendered the initial request at the requested URL and then handled each subsequent URL on the client via |
|
@benmccann I think it's about this: https://vitejs.dev/guide/build.html#multi-page-app. So: Several A single Just like a vanilla Vite SPA, a vanilla Vite MPA also needs |
|
Yes, and the difference between SPA and MPA is that with MPA, sirv should not have |
|
Thanks for the clarification! @patak-dev's proposal from above (#8438 (comment)) sounds fine to me |
|
Should |
We can't because SvelteKit is going to use Interestingly, VitePress has a config option to turn it into an MPA: https://github.com/vuejs/vitepress/blob/0927a7393b3b484d49a2d06d5b41073b40cec244/src/node/config.ts#L66 |
|
Yes, that's correct. We do SSR and use the Vite server as is |
|
Something that I don't like about |
|
I'm not too bothered by |
|
Implemented with |
|
Closing in favor of #8452 |
Description
Reverts the removal of
indexHtmlMiddlewarewhenspa: false. This middleware is needed for regular MPAs in Vite. Ping @brillout @benmccannWhat is the purpose of this pull request?