magne4000 / vite-plugin-vercel

Vercel adapter for vite
https://test-vite-vercel-plugin.vercel.app
98 stars 14 forks source link

usage with vite-SSL on localhost fails #68

Closed digitalkaoz closed 7 months ago

digitalkaoz commented 7 months ago
// vite.config.js
import vercel from 'vite-plugin-vercel';
import mkcert from'vite-plugin-mkcert'
import {defineConfig} from "vite";

console.log(import.meta.env)
export default defineConfig(({mode}) => ({
    vercel: {
    },
    devServer: {
        https: {
            cert: './certs/cert.pem',
            key: './certs/dev.pem'
        }
    },
    plugins: [
        mode === "development" && mkcert({
            savePath: './certs', // save the generated certificate into certs directory
            force: true, // force generation of certs even without setting https property in the vite config
        }),
    ]
}))

when running through vite ssl on localhost works flawless, but when running trough the vercel dev layer withvercel dev`

❯ vercel dev              
Vercel CLI 33.7.0
> Running Dev Command “vite --port $PORT”
The list of generated files:
/Users/.../certs/dev.pem
/Users/.../certs/cert.pem

  VITE v5.2.8  ready in 482 ms

  ➜  Local:   https://localhost:3000/
  ➜  Network: use --host to expose
  ➜  press h + enter to show help
> Ready! Available at http://localhost:3000

accessing https://localhost:3000/ gives an ERR_SSL_PROTOCOL_ERROR

magne4000 commented 7 months ago

Doesn't seem like a vite-plugin-vercel issue. devServer should be renamed to server in a standard vite config file.