代码拉取完成,页面将自动刷新
同步操作将从 ForTheExam/exam-web 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
import { defineConfig,loadEnv } from 'vite'
import vue from '@vitejs/plugin-vue'
// import OptimizationPersist from 'vite-plugin-optimize-persist'
// import PkgConfig from 'vite-plugin-package-config'
// import Components from 'unplugin-vue-components/vite';
// import { ArcoResolver } from 'unplugin-vue-components/resolvers';
import vitePluginForArco from '@arco-plugins/vite-vue'
// import svgLoader from 'vite-svg-loader'
const { resolve } = require('path')
// https://vitejs.dev/config/
export default ({ mode })=>{
const app_ip=loadEnv(mode, process.cwd()).VITE_API_HOST_IP
const app_host=`http://${app_ip}`
const user_path=loadEnv(mode, process.cwd()).VITE_USER_API_URL
const exam_path=loadEnv(mode, process.cwd()).VITE_EXAM_API_URL
const auth_path=loadEnv(mode, process.cwd()).VITE_AUTH_API_URL
const message_path=loadEnv(mode, process.cwd()).VITE_MESSAGE_API_URL
const file_path=loadEnv(mode, process.cwd()).VITE_FILE_API_URL
return defineConfig({
plugins: [
vue(),
// PkgConfig(),
// OptimizationPersist()
// svgLoader(),
//按需加载
vitePluginForArco({
theme:'@arco-themes/vue-mgo-blog',
style: 'css',
// iconPrefix:'icon'
}),
],
server: {
open: '/',
port:3030,
host: '0.0.0.0' ,
proxy: {
//用户微服务
'/uapi': {
target: app_host,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/uapi/, user_path)
},
'/aapi': {
target: app_host,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/aapi/, auth_path)
},
//考试微服务
'/eapi': {
target: app_host,
changeOrigin: true,
rewrite: (path) => path.replace(/^\/eapi/, exam_path)
},
'/mapi': {
target: app_host,
changeOrigin: true,//是否允许跨域
rewrite: (path) => path.replace(/^\/mapi/, message_path),
},
'/fapi': {
target: app_host,
changeOrigin: true,//是否允许跨域
rewrite: (path) => path.replace(/^\/fapi/, file_path),
},
// 代理websocket请求
'/mapi-scoket': {
target: `ws://${app_ip}`,
changeOrigin: true,//是否允许跨域
rewrite: (path) => path.replace(/^\/mapi-scoket/, message_path),
ws: true //开启ws
}
}
},
resolve: {
alias: [//配置别名
{ find: '@', replacement: resolve(__dirname, 'src') },
{ find: '@views', replacement: resolve(__dirname, 'src/views') }
],
// 情景导出 package.json 配置中的exports字段
conditions: [],
// 导入时想要省略的扩展名列表
// 不建议使用 .vue 影响IDE和类型支持
extensions:['.mjs','.js','.ts','.jsx','.tsx','.json']
},
})
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。