We can use vite-plugin-ssr
as well with hapi.
hapi is a Express.js alternative.
We recommend the following setup.
In development, we use two servers:
$ vite
). (It automatically includes vite-plugin-ssr
).vite-plugin-ssr
.This means that in development, Vite is responsible for serving the entire frontend, while our hapi server is responsible only for serving the backend.
When using Express.js we usually integrate the Vite development middleware to Express.js but we cannot do that with hapi, because hapi doesn't support connect middlewares (the Vite development middleware is a connect middleware). See
In production, we use only one server:
dist/client/
and does server-side rendering by using vite-plugin-ssr
's renderPage()
.