43 lines
915 B
TypeScript
43 lines
915 B
TypeScript
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import vueDevTools from 'vite-plugin-vue-devtools'
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [
|
|
vue(),
|
|
vueDevTools(),
|
|
tailwindcss(),
|
|
],
|
|
server: {
|
|
port: 9040,
|
|
open: true, // 自动打开浏览器
|
|
proxy: {
|
|
// 代理 API 请求到后端服务器
|
|
'/api': {
|
|
target: 'http://localhost:9050',
|
|
changeOrigin: true,
|
|
},
|
|
// 代理文件下载请求
|
|
'/files': {
|
|
target: 'http://localhost:9050',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
build: {
|
|
outDir: 'dist',
|
|
assetsDir: 'assets',
|
|
// 清理输出目录
|
|
emptyOutDir: true,
|
|
},
|
|
resolve: {
|
|
alias: {
|
|
'@': fileURLToPath(new URL('./src', import.meta.url))
|
|
},
|
|
},
|
|
})
|