Files
if.u.clients.web/vite.config.ts
mamamiyear c923244a68 feat: support user management
- sign up and delete account with email or phone
- sign in and sign out
- update nickname and avatar
- update account phone or email
2025-11-22 09:53:47 +08:00

34 lines
858 B
TypeScript

import { defineConfig, loadEnv } from 'vite'
import react from '@vitejs/plugin-react'
import fs from 'node:fs'
// https://vite.dev/config/
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')
const keyPath = env.VITE_HTTPS_KEY_PATH
const certPath = env.VITE_HTTPS_CERT_PATH
return {
plugins: [react()],
// Vite 默认支持环境变量,无需额外配置
// 环境变量加载优先级:
// .env.local > .env.[mode] > .env
server: {
https: keyPath && certPath
? {
key: fs.readFileSync(keyPath),
cert: fs.readFileSync(certPath),
}
: undefined,
host: 'localhost',
proxy: {
'/api': {
target: 'http://localhost:8099',
changeOrigin: true,
secure: false,
},
},
},
}
})