Allow disabling sudo requirement and system certificate installation
Currently, vite-plugin-mkcert requires sudo permissions to install certificates to the system. For many development scenarios, this is unnecessary as users are willing to accept certificate warnings in their browsers.
## Problem
The plugin currently:
1. Requires sudo permissions to run properly
2. Always installs certificates to the system trust store
3. Doesn't provide an option for users who are comfortable with browser certificate warnings
This creates friction in environments where:
- Users don't have sudo access
- CI/CD pipelines are running tests
- Shared dev machines are being used for development
- Users simply don't want to modify their system trust store
## Proposed Solution
Add a configuration option (e.g., `installToSystem: false`) that would:
- Skip the system certificate installation step
- Not require sudo permissions
- Still generate the certificates for HTTPS but leave them untrusted
- Allow users to manually accept certificate warnings in their browsers
Example configuration:
```js
import { defineConfig } from 'vite';
import mkcert from 'vite-plugin-mkcert';
export default defineConfig({
plugins: [
mkcert({
installToSystem: false // Skip system installation, no sudo required
})
],
server: {
https: true
}
});
```
关闭于 2025-04-24 1 条评论