tezvyn:

Vite's Low-Level SSR API

Source: vite.devadvanced

Vite's SSR API lets you run Vite as a middleware inside your own Node.js server, giving you full control over rendering. It's for building custom SSR solutions, often with Express. The footgun: most apps should use a higher-level SSR plugin, not this API.

Vite's low-level SSR API treats Vite as a development middleware for your custom Node.js server, rather than a full-fledged server itself. This gives you fine-grained control over the server-rendering pipeline. You'll typically use it with Express to create a server, instantiate Vite with `middlewareMode: true`, and apply `vite.middlewares`. The footgun is reaching for this API too soon; it's intended for framework authors or highly custom setups, not for typical application development where a higher-level SSR plugin is a better fit.

Read the original → vite.dev

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

Vite's Low-Level SSR API · Tezvyn