{"id":20797,"library":"webpack-mkcert","title":"webpack-mkcert","description":"Webpack plugin that provides HTTPS certificates for local development using mkcert. Version 1.0.3, maintained with monthly releases. Unlike manual certificate setups, it automates mkcert download and CA installation, supports multiple hosts (localhost, 127.0.0.1, custom domains), and includes a China mirror for faster downloads. Ships TypeScript types and requires Node >=16.","status":"active","version":"1.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/WXperia/webpack-mkcert","tags":["javascript","webpack-plugin","certificate","https","mkcert","typescript"],"install":[{"cmd":"npm install webpack-mkcert","lang":"bash","label":"npm"},{"cmd":"yarn add webpack-mkcert","lang":"bash","label":"yarn"},{"cmd":"pnpm add webpack-mkcert","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Binary used to generate and install local CA and server certificates.","package":"mkcert","optional":false}],"imports":[{"note":"Package is ESM-only. Default export is a function returning an object with cert and key.","wrong":"const webpackMkcert = require('webpack-mkcert')","symbol":"default","correct":"import webpackMkcert from 'webpack-mkcert'"},{"note":"TypeScript only; options interface for the plugin.","symbol":"WebpackMkcertOptions","correct":"import type { WebpackMkcertOptions } from 'webpack-mkcert'"},{"note":"This package does not export a Webpack plugin class; it returns certificate options.","wrong":"import Plugin from 'webpack-mkcert'","symbol":"Plugin","correct":"import { Plugin } from 'webpack'"}],"quickstart":{"code":"// webpack.config.js (ESM)\nimport webpackMkcert from 'webpack-mkcert';\n\nexport default async () => {\n  const https = await webpackMkcert({\n    source: 'coding',\n    hosts: ['localhost', '127.0.0.1'],\n    force: false\n  });\n\n  return {\n    devServer: {\n      server: {\n        type: 'https',\n        options: {\n          host: 'localhost',\n          ...https\n        }\n      }\n    }\n  };\n};\n","lang":"typescript","description":"Configures a Vue CLI Webpack dev server to use HTTPS with certificates generated by mkcert."},"warnings":[{"fix":"Use async/await or .then() when calling webpackMkcert().","message":"The plugin must be used asynchronously; it returns a Promise.","severity":"gotcha","affected_versions":"*"},{"fix":"Set source to 'coding' for China mirror or provide a local mkcertPath.","message":"On first run, mkcert binary is downloaded automatically. This may fail in restrictive networks.","severity":"gotcha","affected_versions":"*"},{"fix":"Remove force option; certificates are auto-regenerated when hosts change.","message":"The force option is deprecated in favor of always regenerating if needed.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Wrap the config export in an async function as shown in the quickstart.","message":"The plugin must be called inside an async function; it cannot be used in a synchronous config.","severity":"gotcha","affected_versions":"*"},{"fix":"Update your code to handle Buffer objects if you process them directly.","message":"Version 1.0.0 changed the return format from { cert, key } strings to an object with Buffer properties.","severity":"breaking","affected_versions":">=1.0.0"},{"fix":"To remove CA certificates, run mkcert -uninstall manually.","message":"The mkcert binary is saved to a plugin-specific data directory; uninstall via mkcert -uninstall.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Run 'npm install webpack-mkcert' and use ES import: import webpackMkcert from 'webpack-mkcert'.","cause":"Package not installed or import path incorrect.","error":"Error: Cannot find module 'webpack-mkcert'"},{"fix":"Use 'import webpackMkcert from 'webpack-mkcert'' (ESM) instead of 'const webpackMkcert = require('webpack-mkcert')'.","cause":"Using require() instead of default import.","error":"TypeError: webpackMkcert is not a function"},{"fix":"Set option 'source: 'coding'' for China mirror, or provide 'mkcertPath' to a local mkcert binary.","cause":"Automatic download failed or network issue.","error":"Error: mkcert binary not found. Please install mkcert or set mkcertPath."},{"fix":"Run 'mkcert -install' to install the local CA root certificate, or use the plugin's mkcert installation.","cause":"The generated certificate is not trusted by the system.","error":"Error: self signed certificate in certificate chain"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}