Skip to content

Commit d4bc0fb

Browse files
bteabluwy
authored andcommitted
fix(cli): convert special base (#14283)
1 parent df6f32f commit d4bc0fb

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

packages/vite/src/node/cli.ts

+13-1
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,21 @@ const convertHost = (v: any) => {
112112
return v
113113
}
114114

115+
/**
116+
* base may be a number (like 0), should convert to empty string
117+
*/
118+
const convertBase = (v: any) => {
119+
if (v === 0) {
120+
return ''
121+
}
122+
return v
123+
}
124+
115125
cli
116126
.option('-c, --config <file>', `[string] use specified config file`)
117-
.option('--base <path>', `[string] public base path (default: /)`)
127+
.option('--base <path>', `[string] public base path (default: /)`, {
128+
type: [convertBase],
129+
})
118130
.option('-l, --logLevel <level>', `[string] info | warn | error | silent`)
119131
.option('--clearScreen', `[boolean] allow/disable clear screen when logging`)
120132
.option('-d, --debug [feat]', `[string | boolean] show debug logs`)

0 commit comments

Comments
 (0)