@rsbuild/plugin-basic-ssl
TypeScript icon, indicating that this package has built-in type declarations

1.2.1 • Public • Published

@rsbuild/plugin-basic-ssl

Generate an untrusted, self-signed certificate for the HTTPS server.

The Basic SSL plugin will automatically generate a self-signed certificate and set the server.https option. When you visit the page, your browser will indicate that the certificate is not trusted. You can access the HTTPS page after manually confirming this.

npm version license

Usage

Install:

npm add @rsbuild/plugin-basic-ssl -D

Add plugin to your rsbuild.config.ts:

// rsbuild.config.ts
import { pluginBasicSsl } from "@rsbuild/plugin-basic-ssl";

export default {
  plugins: [pluginBasicSsl()],
};

Then visit the https URL of the page, and confirm in your browser.

Options

filename

Filename of the generated certificate.

  • Type: string
  • Default: 'fake-cert.pem'
  • Example:
pluginBasicSsl({
  filename: "foo.pem",
});

outputPath

Output path of the generated certificate.

  • Type: string
  • Default: __dirname
  • Example:
import path from "node:path";

pluginBasicSsl({
  outputPath: path.join(__dirname, "node_modules/.cache/cert"),
});

selfsignedAttrs

Attributes passing to selfsigned, see selfsigned for details.

  • Type: CertificateField[]
  • Default:
const defaultAttrs = [{ name: "commonName", value: "localhost" }];
  • Example:
pluginBasicSsl({
  selfsignedAttrs: [{ name: "commonName", value: "example.com" }],
});

selfsignedOptions

Options passing to selfsigned, see selfsigned - Options for details.

  • Type: SelfsignedOptions
  • Default:
const defaultOptions = {
  days: 30,
  keySize: 2048,
};
  • Example:
pluginBasicSsl({
  selfsignedOptions: {
    days: 100,
  },
});

License

MIT.

/@rsbuild/plugin-basic-ssl/

    Package Sidebar

    Install

    npm i @rsbuild/plugin-basic-ssl

    Weekly Downloads

    15,579

    Version

    1.2.1

    License

    MIT

    Unpacked Size

    13.1 kB

    Total Files

    7

    Last publish

    Collaborators

    • chenjiahan
    • hardfist