29 lines
983 B
TypeScript
29 lines
983 B
TypeScript
import { fileURLToPath, URL } from 'node:url'
|
|
import { defineConfig, loadEnv } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
|
|
/** 开发代理保留 /api 前缀;长工作流不使用代理层的短超时。 */
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, process.cwd(), '')
|
|
return {
|
|
plugins: [vue(), tailwindcss()],
|
|
resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } },
|
|
server: {
|
|
port: 5173,
|
|
proxy: {
|
|
'/api': {
|
|
target: env.API_PROXY_TARGET || 'http://localhost:3412',
|
|
changeOrigin: true,
|
|
timeout: 0,
|
|
proxyTimeout: 0
|
|
},
|
|
'/storage': {
|
|
target: env.API_PROXY_TARGET || 'http://localhost:3412',
|
|
changeOrigin: true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|