https://github.com/rspack-contrib/rsbuild-plugin-basic-ssl
  
  
    An Rsbuild plugin to generate an untrusted, self-signed certificate for the HTTPS server. 
    https://github.com/rspack-contrib/rsbuild-plugin-basic-ssl
  
rsbuild rsbuild-plugin rspack
        Last synced: 7 months ago 
        JSON representation
    
An Rsbuild plugin to generate an untrusted, self-signed certificate for the HTTPS server.
- Host: GitHub
 - URL: https://github.com/rspack-contrib/rsbuild-plugin-basic-ssl
 - Owner: rspack-contrib
 - License: mit
 - Created: 2024-07-01T14:05:12.000Z (over 1 year ago)
 - Default Branch: main
 - Last Pushed: 2025-04-01T02:30:55.000Z (7 months ago)
 - Last Synced: 2025-04-11T22:03:25.219Z (7 months ago)
 - Topics: rsbuild, rsbuild-plugin, rspack
 - Language: TypeScript
 - Homepage:
 - Size: 91.8 KB
 - Stars: 4
 - Watchers: 3
 - Forks: 0
 - Open Issues: 3
 - 
            Metadata Files:
            
- Readme: README.md
 - License: LICENSE
 
 
Awesome Lists containing this project
- awesome-rstack - @rsbuild/plugin-basic-ssl - signed certificate for the HTTPS server. (Plugins / Rsbuild Plugins)
 
README
          # @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](https://rsbuild.dev/config/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.
## Usage
Install:
```bash
npm add @rsbuild/plugin-basic-ssl -D
```
Add plugin to your `rsbuild.config.ts`:
```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:**
```ts
pluginBasicSsl({
  filename: "foo.pem",
});
```
### outputPath
Output path of the generated certificate.
- **Type:** `string`
- **Default:** `__dirname`
- **Example:**
```ts
import path from "node:path";
pluginBasicSsl({
  outputPath: path.join(__dirname, "node_modules/.cache/cert"),
});
```
### selfsignedAttrs
Attributes passing to `selfsigned`, see [selfsigned](https://github.com/jfromaniello/selfsigned) for details.
- **Type:** `CertificateField[]`
- **Default:**
```ts
const defaultAttrs = [{ name: "commonName", value: "localhost" }];
```
- **Example:**
```ts
pluginBasicSsl({
  selfsignedAttrs: [{ name: "commonName", value: "example.com" }],
});
```
### selfsignedOptions
Options passing to `selfsigned`, see [selfsigned - Options](https://github.com/jfromaniello/selfsigned?tab=readme-ov-file#options) for details.
- **Type:** `SelfsignedOptions`
- **Default:**
```ts
const defaultOptions = {
  days: 30,
  keySize: 2048,
};
```
- **Example:**
```ts
pluginBasicSsl({
  selfsignedOptions: {
    days: 100,
  },
});
```
## License
[MIT](./LICENSE).