SSL certs with vite

How to create SSL certs for localhost and configure vite to serve them


Vite SSL

How to create SSL certs for localhost and configure vite to serve them

brew install mkcert nss
mkcert -install localhost
import fs from "fs";
import path from "path";
 
export default {
  server: {
    https: {
      key: fs.readFileSync(path.resolve(__dirname, "./localhost-key.pem")),
      cert: fs.readFileSync(path.resolve(__dirname, "./localhost.pem")),
    },
    // Make sure the server is accessible over the local network
    host: "0.0.0.0",
  },
};