| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- import { defineConfig } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import path from 'path' // 引入 Node.js 的 path 模块
- // https://vite.dev/config/
- export default defineConfig({
- base:process.env.NODE_ENV === 'production' ? ' /evaluationteacher/' : '/' , //测试环境配置,生产环境不需要
- plugins: [vue()],
- resolve: {
- alias: {
- '@': path.resolve(__dirname, './src') // 配置 @ 指向 src 目录
- },
- extensions: ['.ts', '.js', '.vue', '.json'] // 添加这一行
- },
-
- // esbuild: {
- // drop: process.env.NODE_ENV === 'production' ? ['console', 'debugger'] : []
- // },
- server: {
- host: '0.0.0.0',//允许所有ip访问
- port: 5732,//默认端口
- proxy:{
- // '/api':{
- // // target:'https://dev.k12100.net/admin/adminApi',
- // target:'https://dev3.k12100.net/teaching/api/',
- // changeOrigin:true,
- // rewrite:path => path.replace(/^\/api/, '')
- // },
- '/teaching':{
- // target:'https://dev.k12100.net/admin/adminApi',
- // target:'https://index.k12100.net/teaching/', //教师端 测试环境
- target:'http://192.168.1.32:47001/', //教师端 本地
- // target:'http://127.0.1.1:47001/', //教师端 本地
- changeOrigin:true,
- rewrite:path => path.replace(/^\/teaching/, '')
- },
- '/student':{
- // target:'https://index.k12100.net/student/', //学生端 测试环境
- target:'http://192.168.1.32:47003/', //学生端 本地
- changeOrigin:true,
- rewrite:path => path.replace(/^\/student/, '')
- },
- },
- }//配置代理
- })
|