2025-10-29 10:22:14 +08:00
|
|
|
|
import { resolve } from 'node:path'
|
|
|
|
|
|
import { fileURLToPath, URL } from 'node:url'
|
|
|
|
|
|
|
|
|
|
|
|
import { defineConfig } from 'vite'
|
|
|
|
|
|
import vue from '@vitejs/plugin-vue'
|
|
|
|
|
|
import vueDevTools from 'vite-plugin-vue-devtools'
|
|
|
|
|
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
|
|
|
|
import Components from 'unplugin-vue-components/vite'
|
|
|
|
|
|
import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
|
|
|
|
|
|
import tailwindcss from '@tailwindcss/vite'
|
|
|
|
|
|
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
|
|
|
|
|
|
|
|
|
|
|
const pathSrc = resolve(__dirname, 'src')
|
|
|
|
|
|
|
|
|
|
|
|
// https://vite.dev/config/
|
|
|
|
|
|
export default defineConfig({
|
2025-12-21 15:28:59 +08:00
|
|
|
|
base: '',
|
2025-10-29 10:22:14 +08:00
|
|
|
|
plugins: [
|
|
|
|
|
|
vue(),
|
|
|
|
|
|
tailwindcss(),
|
|
|
|
|
|
vueDevTools(),
|
|
|
|
|
|
AutoImport({
|
|
|
|
|
|
imports: ['vue'],
|
|
|
|
|
|
resolvers: [ElementPlusResolver()],
|
|
|
|
|
|
eslintrc: {
|
|
|
|
|
|
enabled: false,
|
|
|
|
|
|
// 1、改为true用于生成eslint配置。2、生成后改回false,避免重复生成消耗
|
|
|
|
|
|
},
|
|
|
|
|
|
}),
|
|
|
|
|
|
Components({
|
|
|
|
|
|
resolvers: [ElementPlusResolver()],
|
|
|
|
|
|
}),
|
|
|
|
|
|
createSvgIconsPlugin({
|
|
|
|
|
|
// 指定需要缓存的图标文件夹
|
|
|
|
|
|
iconDirs: [resolve(pathSrc, 'assets/icons')],
|
|
|
|
|
|
// 指定symbolId格式
|
|
|
|
|
|
symbolId: 'icon-[dir]-[name]',
|
|
|
|
|
|
}),
|
|
|
|
|
|
],
|
|
|
|
|
|
resolve: {
|
|
|
|
|
|
alias: {
|
2025-12-15 20:46:54 +08:00
|
|
|
|
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
2025-10-29 10:22:14 +08:00
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
server: {
|
|
|
|
|
|
proxy: {
|
|
|
|
|
|
'/api': {
|
|
|
|
|
|
changeOrigin: true,
|
|
|
|
|
|
// 接口地址
|
2025-12-21 15:28:59 +08:00
|
|
|
|
target: 'http://82.157.183.212:21092',
|
|
|
|
|
|
// target: 'http://localhost:8000',
|
|
|
|
|
|
// rewrite: (path: string) => path.replace(/^\/api/, ''),
|
|
|
|
|
|
// configure: (proxy, options) => {
|
|
|
|
|
|
// console.log('Proxy configured:', options)
|
|
|
|
|
|
// },
|
2025-10-29 10:22:14 +08:00
|
|
|
|
},
|
|
|
|
|
|
},
|
2025-12-15 20:46:54 +08:00
|
|
|
|
},
|
2025-10-29 10:22:14 +08:00
|
|
|
|
})
|