43 lines
1.1 KiB
TypeScript
43 lines
1.1 KiB
TypeScript
import { defineConfig } from 'vite'
|
|
import vue from '@vitejs/plugin-vue'
|
|
import path from 'path'
|
|
|
|
const API_HOST = '192.168.1.7'
|
|
// const API_HOST = '127.0.0.1'
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
plugins: [vue()],
|
|
resolve: {
|
|
// 配置路径别名
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src')
|
|
}
|
|
},
|
|
server: {
|
|
// 服务器代理 服务器没有部署Nginx的情况下使用
|
|
proxy: {
|
|
'/home-api': {
|
|
target: `http://${API_HOST}:8081`,
|
|
changeOrigin: true,
|
|
rewrite: (item) => item.replace(/^\/home-api/, '')
|
|
},
|
|
'/blog-api': {
|
|
target: `http://${API_HOST}:8082`,
|
|
changeOrigin: true,
|
|
rewrite: (item) => item.replace(/^\/blog-api/, '')
|
|
},
|
|
'/alist-api': {
|
|
target: 'http://192.168.1.7:5244',
|
|
changeOrigin: true,
|
|
rewrite: (item) => item.replace(/^\/alist-api/, '')
|
|
},
|
|
'/image-api': {
|
|
target: 'http://192.168.1.7:3000',
|
|
changeOrigin: true,
|
|
rewrite: (item) => item.replace(/^\/image-api/, '')
|
|
}
|
|
}
|
|
}
|
|
})
|