Registry / auth-security / webpack-mkcert

webpack-mkcert

JSON →
library1.0.3jsnpmunverified

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.

npm install webpack-mkcert
INSTALL
IMPORT
SIG · WEBPACK-MKCERT
W
webpack-mkcert
auth-securityjavascriptv1.0.3
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import webpackMkcert from 'webpack-mkcert'
const webpackMkcert = require('webpack-mkcert')
Package is ESM-only. Default export is a function returning an object with cert and key.
WebpackMkcertOptions
import type { WebpackMkcertOptions } from 'webpack-mkcert'
TypeScript only; options interface for the plugin.
Plugin
import { Plugin } from 'webpack'
import Plugin from 'webpack-mkcert'
This package does not export a Webpack plugin class; it returns certificate options.

Configures a Vue CLI Webpack dev server to use HTTPS with certificates generated by mkcert.

// webpack.config.js (ESM) import webpackMkcert from 'webpack-mkcert'; export default async () => { const https = await webpackMkcert({ source: 'coding', hosts: ['localhost', '127.0.0.1'], force: false }); return { devServer: { server: { type: 'https', options: { host: 'localhost', ...https } } } }; };
Debug
Known issues
gotchaThe plugin must be used asynchronously; it returns a Promise.
fix
Use async/await or .then() when calling webpackMkcert().
affects: *
gotchaOn first run, mkcert binary is downloaded automatically. This may fail in restrictive networks.
fix
Set source to 'coding' for China mirror or provide a local mkcertPath.
affects: *
deprecatedThe force option is deprecated in favor of always regenerating if needed.
fix
Remove force option; certificates are auto-regenerated when hosts change.
affects: >=1.0.0
gotchaThe plugin must be called inside an async function; it cannot be used in a synchronous config.
fix
Wrap the config export in an async function as shown in the quickstart.
affects: *
breakingVersion 1.0.0 changed the return format from { cert, key } strings to an object with Buffer properties.
fix
Update your code to handle Buffer objects if you process them directly.
affects: >=1.0.0
gotchaThe mkcert binary is saved to a plugin-specific data directory; uninstall via mkcert -uninstall.
fix
To remove CA certificates, run mkcert -uninstall manually.
affects: *
Errors
Common errors & fixes
Error: Cannot find module 'webpack-mkcert'
Package not installed or import path incorrect.
fix
Run 'npm install webpack-mkcert' and use ES import: import webpackMkcert from 'webpack-mkcert'.
TypeError: webpackMkcert is not a function
Using require() instead of default import.
fix
Use 'import webpackMkcert from 'webpack-mkcert'' (ESM) instead of 'const webpackMkcert = require('webpack-mkcert')'.
Error: mkcert binary not found. Please install mkcert or set mkcertPath.
Automatic download failed or network issue.
fix
Set option 'source: 'coding'' for China mirror, or provide 'mkcertPath' to a local mkcert binary.
Error: self signed certificate in certificate chain
The generated certificate is not trusted by the system.
fix
Run 'mkcert -install' to install the local CA root certificate, or use the plugin's mkcert installation.
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies
mkcertrequiredBinary used to generate and install local CA and server certificates.
Agent activity
30 hits · last 30 days
node
24
OpenAI (training)
1
Resources
webpack-mkcert — npm install webpack-mkcert · libregistry