| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- import { defineConfig } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import path from 'path' // 引入 Node.js 的 path 模块
- // https://vite.dev/config/
- export default defineConfig({
- plugins: [vue()],
- resolve: {
- alias: {
- '@': path.resolve(__dirname, './src') // 配置 @ 指向 src 目录
- },
- extensions: ['.ts', '.js', '.vue', '.json'] // 添加这一行
- },
- build: {
- sourcemap: false, // 不生成 source map,隐藏源码
- minify: 'terser',
- terserOptions: {
- compress: {
- drop_console: true, // 移除所有 console 输出
- drop_debugger: true, // 移除 debugger 调试语句
- pure_funcs: ['console.log', 'console.info', 'console.warn', 'console.error'] // 移除指定的 console 函数
- }
- }
- },
- server: {
- host: '0.0.0.0',//允许所有ip访问
- port: 5731,//默认端口
- proxy:{
- // '/api':{
- // // target:'https://dev.k12100.net/admin/adminApi',
- // target:'https://dev3.k12100.net/teaching/api/',
- // changeOrigin:true,
- // rewrite:path => path.replace(/^\/api/, '')
- // },
- '/adminApi':{
- target:'https://admin.k12100.net/admin/adminApi',//测试
- // target:'https://admin.k12100.com/admin/adminApi',//线上
- // target:'http://192.168.1.61:47002/adminApi',
- changeOrigin:true,
- rewrite:path => path.replace(/^\/adminApi/, '')
- }
- },
-
- }//配置代理
- })
|