feat(cli): allow to custom server.port (#11222)

This commit is contained in:
neverland 2022-11-05 20:03:58 +08:00 committed by GitHub
parent cedbc089b4
commit d9fe675af4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -114,12 +114,12 @@ export function smartOutputFile(filePath: string, content: string) {
outputFileSync(filePath, content);
}
export function mergeCustomViteConfig(config: InlineConfig) {
export function mergeCustomViteConfig(config: InlineConfig): InlineConfig {
const vantConfig = getVantConfig();
const configureVite = vantConfig.build?.configureVite;
if (configureVite) {
return configureVite(config);
return configureVite(config) || config;
}
return config;
}

View File

@ -34,7 +34,7 @@ export async function compileSite(production = false) {
} else {
const config = mergeCustomViteConfig(getViteConfigForSiteDev());
const server = await createServer(config);
await server.listen();
await server.listen(config.server?.port);
const require = createRequire(import.meta.url);
const { version } = require('vite/package.json');