提交 bfb5d4f3 编写于 作者: fxy060608's avatar fxy060608

feat(cli): support base option (#3318)

上级 470cc0bc
......@@ -74,6 +74,7 @@ function initBuildOptions(
): InlineConfig {
return {
root: process.env.VITE_ROOT_DIR,
base: options.base,
logLevel: options.logLevel,
clearScreen: options.clearScreen,
mode: options.mode,
......
......@@ -14,6 +14,7 @@ export interface CliOptions {
p?: string
ssr?: boolean
base?: string
debug?: boolean | string
d?: boolean | string
filter?: string
......@@ -33,6 +34,7 @@ cli
.option('-p, --platform [platform]', '[string] ' + PLATFORMS.join(' | '), {
default: 'h5',
})
.option('--base <path>', `[string] public base path (default: /)`)
.option('-ssr', '[boolean] server-side rendering', {
default: false,
})
......
......@@ -17,6 +17,7 @@ export async function createServer(options: CliOptions & ServerOptions) {
const server = await createViteServer(
addConfigFile({
root: process.env.VITE_ROOT_DIR,
base: options.base,
mode: options.mode,
logLevel: options.logLevel,
clearScreen: options.clearScreen,
......@@ -52,6 +53,7 @@ export async function createSSRServer(
const vite = await createViteServer(
addConfigFile({
root: process.env.VITE_ROOT_DIR,
base: options.base,
mode: options.mode,
logLevel: options.logLevel,
clearScreen: options.clearScreen,
......
......@@ -184,6 +184,7 @@ export function cleanOptions(options: CliOptions) {
delete ret.p
delete ret.ssr
delete ret.base
delete ret.debug
delete ret.d
delete ret.filter
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册