Files
sankey/vite.config.ts
2026-02-14 14:39:57 +08:00

29 lines
758 B
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import { readFileSync, existsSync } from 'node:fs';
import { homedir } from 'node:os';
import { join } from 'node:path';
const certDir = join(homedir(), 'mac.biboer.cn_ecc');
const certPath = join(certDir, 'fullchain.cer');
const keyPath = join(certDir, 'mac.biboer.cn.key');
// 只在证书存在时启用 HTTPS开发环境
const httpsConfig = existsSync(certPath) && existsSync(keyPath)
? {
cert: readFileSync(certPath),
key: readFileSync(keyPath)
}
: undefined;
export default defineConfig({
plugins: [vue()],
server: {
host: '0.0.0.0',
port: 5173,
strictPort: true,
allowedHosts: ['mac.biboer.cn'],
https: httpsConfig
}
});