{"id":22742,"library":"vite-plugin-mkcert","title":"vite-plugin-mkcert","description":"Vite plugin that uses mkcert to automatically generate and trust locally valid HTTPS certificates for Vite's dev server. Current stable version is v2.0.0 (2026-04-09). Release cadence is frequent with several minor/patch versions per year. Key differentiators: zero-config setup, automatic local IP hosts, support for mobile device trust instructions, and a built-in mkcert binary downloader. Since v1.17.12, it replaced axios with native fetch, removing a long-standing supply chain risk. v2.0.0 requires Node.js >= 22.19.0 and Vite >= 3. Compared to alternatives like @vitejs/plugin-basic-ssl, this plugin provides a proper local CA that works across browsers and avoids browser security warnings.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/liuweiGL/vite-plugin-mkcert","tags":["javascript","vite-plugin","certificate","https","mkcert","typescript"],"install":[{"cmd":"npm install vite-plugin-mkcert","lang":"bash","label":"npm"},{"cmd":"yarn add vite-plugin-mkcert","lang":"bash","label":"yarn"},{"cmd":"pnpm add vite-plugin-mkcert","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency; the plugin hooks into Vite's dev server to inject HTTPS certificates","package":"vite","optional":false}],"imports":[{"note":"ESM-only since v2.0.0; default export.","wrong":"const mkcert = require('vite-plugin-mkcert')","symbol":"mkcert","correct":"import mkcert from 'vite-plugin-mkcert'"},{"note":"The package exports a single function as default. Named import will fail.","wrong":"import { mkcert } from 'vite-plugin-mkcert'","symbol":"mkcert (default)","correct":"import mkcert from 'vite-plugin-mkcert'"},{"note":"TypeScript types are included; Options interface for plugin configuration.","symbol":"type import","correct":"import type { Options } from 'vite-plugin-mkcert'"}],"quickstart":{"code":"import { defineConfig } from 'vite';\nimport mkcert from 'vite-plugin-mkcert';\n\nexport default defineConfig({\n  server: { https: true },\n  plugins: [mkcert()]\n});","lang":"typescript","description":"Basic setup of vite-plugin-mkcert with Vite. Enables HTTPS dev server and auto-generates trusted certificates."},"warnings":[{"fix":"Upgrade Node.js to >=22.19.0","message":"v2.0.0 drops support for Node.js < 22.19.0","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Use import or dynamic import() instead of require()","message":"v2.0.0 is ESM-only; require() will fail","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"If you relied on axios-specific proxy options, switch to the new proxy option or environment variables (HTTPS_PROXY, HTTP_PROXY)","message":"v1.17.12 replaced axios with native fetch; proxy configuration changed","severity":"breaking","affected_versions":">=1.17.12"},{"fix":"With Vite 5+, you can omit server: { https: true } and just use the plugin","message":"v1.x required server.https setting; Vite 5+ defaults to https when plugin is present","severity":"deprecated","affected_versions":">=1.0.0 <2.0.0"},{"fix":"Set source: 'coding' for Chinese mirror, or provide mkcertPath to a local binary","message":"Plugin downloads mkcert binary from GitHub; network restrictions may fail","severity":"gotcha","affected_versions":"all"},{"fix":"Upgrade to v1.17.4+ which fixes path escaping, or avoid parentheses in folder names","message":"Parentheses in the project folder path cause mkcert command to fail","severity":"gotcha","affected_versions":"<1.17.4"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install mkcert manually or ensure the plugin can download it (check network/proxy settings)","cause":"mkcert binary not installed or not found in PATH","error":"Error: spawn mkcert ENOENT"},{"fix":"Change to import mkcert from 'vite-plugin-mkcert' and ensure your project is ESM via \"type\": \"module\" in package.json","cause":"Using require() on an ESM-only package (v2+)","error":"Error [ERR_REQUIRE_ESM]: require() of ES Module not supported"},{"fix":"Run 'mkcert -install' or let the plugin automatically install the CA (requires admin/sudo)","cause":"Root CA not trusted by the system","error":"Error: unable to get local issuer certificate"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}