absolute mkcert
Setup trusted HTTPS certificates for local development.
#Usage
Creates locally-trusted development certificates so your browser accepts HTTPS on localhost without warnings.
BASH
# Setup trusted HTTPS certificates for local development
absolute mkcert#Why HTTPS in Dev
HTTP/2 Multiplexing
Faster HMR on pages with many imports: HTTP/2 sends all modules over a single connection.
Secure Context APIs
Test APIs that require HTTPS like service workers, Web Crypto, and geolocation.
Production Parity
Catch mixed-content issues and CORS problems before they hit production.
#Prerequisites
Install mkcert on your system before running the command:
macOS
brew install mkcertLinux
sudo apt install mkcert or yay -S mkcertWindows
choco install mkcert#Enabling HTTPS
After generating certificates, enable HTTPS in your config:
TS
// absolute.config.ts
export default defineConfig({
// ...
dev: {
https: true,
},
});The dev server will now use HTTPS with HTTP/2. Your browser will trust the certificate automatically.