Peter Mekhaeil

Enable HTTP/2 in Vite's Dev Server by using HTTPS

Take advantage of HTTP/2 in Vite Dev Server by enabling server.https in your vite.config.js.

  server: {
    https: true

Browsers limit the number of active connections per domain when using HTTP/1.1 and this can be avoided by enabling HTTP/2 which supports unlimited concurrent requests.

Vite's Dev server takes advantage of modern browser's support for ES Modules and instead of bundling your site, the dev server will serve the modules via network requests in your browser. Enabling HTTP/2 can come handy in large applications that need to serve a lot of these modules.