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

feat: support config file (3948)

上级 e91c559b
......@@ -70,6 +70,7 @@ function initBuildOptions(
): InlineConfig {
return {
root: process.env.VITE_ROOT_DIR,
configFile: options.config,
base: options.base,
logLevel: options.logLevel,
clearScreen: options.clearScreen,
......
......@@ -10,6 +10,9 @@ const cli = cac('uni')
export interface CliOptions {
'--'?: string[]
c?: boolean | string
config?: string
platform?: string
p?: string
ssr?: boolean
......@@ -31,6 +34,7 @@ export interface CliOptions {
}
cli
.option('-c, --config <file>', `[string] use specified config file`)
.option('-p, --platform [platform]', '[string] ' + PLATFORMS.join(' | '), {
default: 'h5',
})
......
......@@ -21,6 +21,7 @@ export async function createServer(options: CliOptions & ServerOptions) {
const server = await createViteServer(
addConfigFile({
root: process.env.VITE_ROOT_DIR,
configFile: options.config,
base: options.base,
mode: options.mode,
logLevel: options.logLevel,
......@@ -59,6 +60,7 @@ export async function createSSRServer(
// custom: don't include HTML middlewares
appType: 'custom',
root: process.env.VITE_ROOT_DIR,
configFile: options.config,
base: options.base,
mode: options.mode,
logLevel: options.logLevel,
......
......@@ -233,6 +233,9 @@ export function cleanOptions(options: CliOptions) {
const ret = { ...options }
delete ret['--']
delete ret.c
delete ret.config
delete ret.platform
delete ret.p
delete ret.ssr
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册