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

1.17.5 • Public • Published

@deskbtm/dev-mkcert

Use mkcert to provide certificate support for https development services.

Quick start

  1. Installation dependencies
yarn add @deskbtm/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

/@deskbtm/dev-mkcert/

    Package Sidebar

    Install

    npm i @deskbtm/dev-mkcert

    Weekly Downloads

    0

    Version

    1.17.5

    License

    MIT

    Unpacked Size

    160 kB

    Total Files

    30

    Last publish

    Collaborators

    • deskbtm