Files
gym-manage/gym-manage-uniapp/vite.config.js
T
2026-06-29 13:35:29 +08:00

32 lines
790 B
JavaScript

import { defineConfig } from 'vite'
import uni from '@dcloudio/vite-plugin-uni'
import path from 'path'
// 用来匹配地址,解决跨域问题
export default defineConfig({
plugins: [uni()],
// 配置源目录为根目录,不使用src
uni: {
inputDir: path.resolve(__dirname, '.')
},
resolve: {
alias: {
'@': path.resolve(__dirname, '.')
},
},
server: {
proxy: {
'/api': {
target: 'http://192.168.5.15:8084',
changeOrigin: true,
secure: true,
bypass: function(req, res, proxyOptions) {
if (req.url.indexOf('.js') !== -1 || req.url.indexOf('.vue') !== -1 ||
req.url.indexOf('.css') !== -1 || req.url.indexOf('.json') !== -1) {
return req.url
}
}
}
}
}
})