first commit
This commit is contained in:
96
vite.config.ts
Normal file
96
vite.config.ts
Normal file
@@ -0,0 +1,96 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import AutoImport from 'unplugin-auto-import/vite'
|
||||
import Components from 'unplugin-vue-components/vite'
|
||||
import { AntDesignVueResolver } from 'unplugin-vue-components/resolvers'
|
||||
import Icons from 'unplugin-icons/vite'
|
||||
import IconsResolver from 'unplugin-icons/resolver'
|
||||
import path from 'path'
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
vue(),
|
||||
// Vue函数自动导入
|
||||
AutoImport({
|
||||
imports: [
|
||||
'vue',
|
||||
'vue-router',
|
||||
'pinia',
|
||||
{
|
||||
'axios': [
|
||||
['default', 'axios']
|
||||
]
|
||||
}
|
||||
],
|
||||
dts: 'src/auto-imports.d.ts',
|
||||
eslintrc: {
|
||||
enabled: false
|
||||
}
|
||||
}),
|
||||
// 组件自动导入
|
||||
Components({
|
||||
resolvers: [
|
||||
// Ant Design Vue组件自动导入
|
||||
AntDesignVueResolver({
|
||||
importStyle: false
|
||||
}),
|
||||
// Ant Design Vue图标自动导入
|
||||
IconsResolver({
|
||||
prefix: 'icon',
|
||||
enabledCollections: ['ant-design']
|
||||
})
|
||||
],
|
||||
dts: 'src/components.d.ts'
|
||||
}),
|
||||
// 图标插件
|
||||
Icons({
|
||||
autoInstall: true,
|
||||
compiler: 'vue3'
|
||||
})
|
||||
],
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, 'src')
|
||||
}
|
||||
},
|
||||
// 开发服务器配置
|
||||
server: {
|
||||
port: 5173,
|
||||
proxy: {
|
||||
// 主服务器代理
|
||||
'/1panel-api/server1': {
|
||||
target: 'http://47.109.57.58:42588',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/1panel-api\/server1/, '/api/v2'),
|
||||
configure: (proxy) => {
|
||||
proxy.on('proxyReq', (proxyReq, req) => {
|
||||
console.log(`[1Panel Proxy - 主服务器] ${req.method} ${req.url}`)
|
||||
})
|
||||
}
|
||||
},
|
||||
// 测试服务器代理
|
||||
'/1panel-api/server2': {
|
||||
target: 'http://192.168.1.100:42588',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/1panel-api\/server2/, '/api/v2'),
|
||||
configure: (proxy) => {
|
||||
proxy.on('proxyReq', (proxyReq, req) => {
|
||||
console.log(`[1Panel Proxy - 测试服务器] ${req.method} ${req.url}`)
|
||||
})
|
||||
}
|
||||
},
|
||||
// 备份服务器代理
|
||||
'/1panel-api/server3': {
|
||||
target: 'http://10.0.0.1:42588',
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/1panel-api\/server3/, '/api/v2'),
|
||||
configure: (proxy) => {
|
||||
proxy.on('proxyReq', (proxyReq, req) => {
|
||||
console.log(`[1Panel Proxy - 备份服务器] ${req.method} ${req.url}`)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user