49 lines
1.2 KiB
JavaScript
49 lines
1.2 KiB
JavaScript
/*
|
||
* @Author: 季万俊
|
||
* @Date: 2025-06-10 14:36:16
|
||
* @Description:
|
||
*/
|
||
import { defineConfig } from 'vite'
|
||
import { fileURLToPath, URL } from 'node:url'
|
||
import vue from '@vitejs/plugin-vue'
|
||
// https://vitejs.dev/config/
|
||
|
||
export default defineConfig({
|
||
plugins: [vue()],
|
||
base: '',
|
||
resolve: {
|
||
alias: {
|
||
'@': fileURLToPath(new URL('./src', import.meta.url))
|
||
}
|
||
},
|
||
proxy: {
|
||
['/dev-api']: {
|
||
target: `http://172.16.1.103:8081/njbzApi`, // 汤
|
||
// target: `http://119.57.137.22:8000/njbzApi`, // 外网
|
||
changeOrigin: true,
|
||
pathRewrite: {
|
||
["^" + '/dev-api']: "",
|
||
},
|
||
},
|
||
['/njbzControlApi']: {
|
||
// target: `http://119.57.137.22:8081/iotApi`,
|
||
// target: `http://119.57.137.22:9000/njbzControlApi`,
|
||
target: `http://172.16.1.155:8081/njbzControlApi`, // 秦
|
||
changeOrigin: true,
|
||
pathRewrite: {
|
||
["^" + '/njbzControlApi']: "",
|
||
},
|
||
rewrite: (path) => path.replace(/^\/dev-api\/njbzControlApi/, ""),
|
||
},
|
||
},
|
||
server: {
|
||
host: '0.0.0.0', // 关键:允许通过IP访问(监听所有网络接口)
|
||
port: 86,
|
||
open: true, // 可选:启动时自动打开浏览器,
|
||
proxy: {
|
||
|
||
}
|
||
}
|
||
})
|
||
|