Files
admin-sjzx/vite.config.ts

56 lines
1.8 KiB
TypeScript
Raw Normal View History

2024-02-19 13:44:32 +08:00
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import vueJsx from '@vitejs/plugin-vue-jsx'
2024-05-09 14:18:39 +08:00
import AutoImport from 'unplugin-auto-import/vite'
2024-04-07 13:43:30 +08:00
import { svgBuilder } from '/@/components/icon/svg/index'
2024-02-19 13:44:32 +08:00
import path from 'path'
2024-04-07 13:43:30 +08:00
const nodeResolve = (dir: string): any => path.resolve(__dirname, '.', dir)
2024-02-19 13:44:32 +08:00
// https://vitejs.dev/config/
export default defineConfig({
2024-06-12 16:16:02 +08:00
plugins: [
vue(),
svgBuilder('./src/assets/icons/'),
vueJsx(),
2024-05-09 14:18:39 +08:00
AutoImport({
//自动引入
2024-06-12 16:16:02 +08:00
imports: ['vue', 'vue-router', 'pinia']
})
2024-05-09 14:18:39 +08:00
],
2024-02-19 13:44:32 +08:00
server: {
2024-02-19 16:38:49 +08:00
host: '0.0.0.0',
2024-04-18 14:54:35 +08:00
open: true,
2024-02-19 13:44:32 +08:00
proxy: {
'/api': {
// target: 'http://10.95.53.49:10215', //海南服务器ip
// target: 'http://10.118.135.128:10215', ///hsw
target: 'http://192.168.1.122:10215', ///hsw
// target: 'http://108c3dfb.r18.cpolar.top', ///hsw
2024-06-12 16:16:02 +08:00
// target: 'http://10.119.65.152:10215', //数据中心
2024-02-19 13:44:32 +08:00
changeOrigin: true,
rewrite: path => path.replace(/^\/api/, '') //路径重写,把'/api'替换为''
2024-02-28 09:42:07 +08:00
},
2024-06-12 16:16:02 +08:00
'/api-docx': {
// 文件服务器地址
target: 'http://192.168.1.22:9009',
2024-06-12 16:16:02 +08:00
changeOrigin: true,
rewrite: path => path.replace(/^\/api-docx/, '')
},
2024-02-28 09:42:07 +08:00
'/map': {
// target: 'http://10.95.53.49:8088', //海南服务器ip
target: 'http://192.168.1.125:9009', //hsw
// target: 'http://192.168.1.125:8088', //数据中心
changeOrigin: true
2024-03-08 10:33:06 +08:00
}
2024-02-19 13:44:32 +08:00
}
},
resolve: {
alias: {
2024-04-07 13:43:30 +08:00
'/@': nodeResolve('.src'),
2024-02-19 13:44:32 +08:00
'@': nodeResolve('src'),
'~': nodeResolve('public')
}
}
})