You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use mkcert to provide certificate support for vite https development services.
When should I use this plugin
When you want to use http/2 to solve the concurrency limit of vite http dev server requests, you find that the browser cache is invalid #2725.
I have obsessive-compulsive disorder, and I hope that the browser will not show annoying https certificate errors.
Effect
View
Quick start
Installation dependencies
yarn add vite-plugin-mkcert -D
Configure vite
import{defineConfig}from'vite'importmkcertfrom'vite-plugin-mkcert'// https://vitejs.dev/config/exportdefaultdefineConfig({server: {https: true},// Not needed for Vite 5+ (simply omit this option)plugins: [mkcert()]})
Parameters
hosts
Custom hosts, default value is localhost + local ip addrs.
force
Whether to force generate.
autoUpgrade
Whether to automatically upgrade mkcert.
source
Specify the download source of mkcert, domestic users can set it to coding to download from the coding.net mirror, or provide a custom BaseSource.
mkcertPath
If the network is restricted, you can specify a local mkcert file instead of downloading from the network.
savePath
The location to save the files, such as the downloaded mkcert program and the generated CA file, private key and certificate file, etc. Default value is PLUGIN_DATA_DIR
keyFileName
The name of private key file generated by mkcert
certFileName
The name of cert file generated by mkcert
Mobile devices
For the certificates to be trusted on mobile devices, you will have to install the root CA. It's the rootCA.pem file in the folder printed by mkcert -CAROOT.