vite.config.ts
766 Bytes
// 开发:pnpm dev(http://127.0.0.1:5173,/api 代理到本机云端 58000)。构建:pnpm build → dist/(云端直接托管)。
import vue from '@vitejs/plugin-vue'
import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
const target = process.env.API_TARGET || 'http://127.0.0.1:58000'
export default defineConfig({
plugins: [vue()],
resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } },
server: { host: '127.0.0.1', port: 5173, proxy: { '/api': target, '/healthz': target } },
build: {
outDir: 'dist',
chunkSizeWarningLimit: 1500,
rollupOptions: {
output: { manualChunks: { 'element-plus': ['element-plus'], vant: ['vant'], vue: ['vue', 'vue-router'] } },
},
},
})