Files
gym-manage/gym-manage-uniapp/vite.config.js
T

32 lines
787 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://localhost: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
}
}
}
}
}
})