Skip to content

Commit 85c1552

Browse files
committed
feat: add enable option
1 parent f064485 commit 85c1552

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ UHRP_AUTO_INSTALL_CADDY=true npm i unplugin-https-reverse-proxy --save-dev
1616

1717
```ts
1818
interface Options {
19+
enable?: boolean // <- default: true
1920
target: string // <- https target hostname
2021
showCaddyLog?: boolean // <- default: false
2122
}
@@ -26,11 +27,11 @@ interface Options {
2627

2728
```ts
2829
// vite.config.ts
29-
import Starter from 'unplugin-https-reverse-proxy/vite'
30+
import HttpsReverseProxy from 'unplugin-https-reverse-proxy/vite'
3031

3132
export default defineConfig({
3233
plugins: [
33-
Starter({ /* options */ }),
34+
HttpsReverseProxy({ /* options */ }),
3435
],
3536
})
3637
```

src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,11 @@ export const unpluginFactory: UnpluginFactory<Options> = options => ({
2020
},
2121
configureServer(server) {
2222
const {
23+
enable = true,
2324
target = '',
2425
} = options
26+
if (!enable)
27+
return
2528
if (!target) {
2629
consola.fail('please provide target')
2730
return
@@ -62,8 +65,11 @@ export const unpluginFactory: UnpluginFactory<Options> = options => ({
6265
},
6366
webpack(compiler) {
6467
const {
68+
enable = true,
6569
target = '',
6670
} = options
71+
if (!enable)
72+
return
6773
if (!target) {
6874
consola.fail('please provide target')
6975
return

src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export interface Options {
22
// define your plugin options here
3+
enable?: boolean
34
target: string
45
showCaddyLog?: boolean
56
}

0 commit comments

Comments
 (0)