@publishjs/dev-mkcert
TypeScript icon, indicating that this package has built-in type declarations

1.17.5 • Public • Published

@publishjs/dev-mkcert

Use mkcert to provide certificate support for https development services.

Quick start

  1. Installation dependencies
yarn add @publishjs/dev-mkcert -D
  1. Configure webpack
const { mkcert } = require('..');
const HTML = require('html-webpack-plugin');
const path = require('path');

/**
 * @type {import('webpack').Configuration}
 */
module.exports = async function () {
  const cert = await mkcert();

  return {
    context: __dirname,
    mode: 'development',
    entry: './main.js',
    plugins: [
      new HTML({
        template: path.resolve(__dirname, './index.html'),
        minify: false,
        filename: 'index.html',
      }),
    ],
    devServer: {
      host: 'localhost',
      port: 3000,
      server: {
        type: 'https',
        options: cert,
      },
    },
  };
};

Principle

Use mkcert to install the local CA certificate and generate it for server.https Server certificate.

Friendly reminder

  1. Uninstall the CA certificate: mkcert -uninstall

Thanks

Package Sidebar

Install

npm i @publishjs/dev-mkcert

Weekly Downloads

2

Version

1.17.5

License

MIT

Unpacked Size

160 kB

Total Files

30

Last publish

Collaborators

  • deskbtm