| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 | import { defineConfig, loadEnv } from 'vite'import vue from '@vitejs/plugin-vue'import monacoEditorPlugin from 'vite-plugin-monaco-editor';//1、 导入 path 模块,帮助我们解析路径import { resolve } from 'path'//2-1 自动导入vue中hook reactive ref等import AutoImport from 'unplugin-auto-import/vite'//2-2 自动导入ui-组件 比如说ant-design-vue  element-plus等import Components from 'unplugin-vue-components/vite'//3、vue3语法糖import VueSetupExtend from 'vite-plugin-vue-setup-extend'// https://vitejs.dev/config/export default defineConfig(({ mode }) => {    const config = loadEnv(mode, './');    console.log(config);    return {        base: "./",        plugins: [            vue(),             monacoEditorPlugin({}), // 启用 Monaco Editor 插件            AutoImport({                //安装两行后你会发现在组件中不用再导入ref,reactive等                imports: ['vue', 'vue-router'],                //存放的位置                dts: "src/auto-import.d.ts",            }),            Components({                // 引入组件的,包括自定义组件,存放的位置                dts: "src/components.d.ts",            }),            VueSetupExtend(),        ],        //1、 ↓解析配置        resolve: {            // ↓路径别名            alias: {                '@': resolve('src')            }        },        //代理        server: {            proxy: {                '/api': {                    // target: 'http://192.168.0.131:8188/TransServlet',//配置文件获取地址                   target: 'https://www.adicn.com/airopt',                    secure: false, //接受使用https                    changeOrigin: true, //允许跨域                    ws: false, //使用websocket                    rewrite: (path) => path.replace(/^\/api/, '')                },                '/airopt': {                    // target: 'http://192.168.0.131:8188/TransServlet',//配置文件获取地址                   target: 'https://www.adicn.com/airopt',                    secure: false, //接受使用https                    changeOrigin: true, //允许跨域                    ws: false, //使用websocket                    rewrite: (path) => path.replace(/^\/airopt/, '')                },                '/file': {                    // target: 'http://192.168.0.15:8081/', // 后端接口地址                    target: 'http://192.168.0.43:2201/',                    secure: false, //接受使用https                    changeOrigin: true, //允许跨域                    ws: false, //使用websocket                    pathRewrite: { // 路径重写                        '^/file': ''                    }                }, '/websokct': {                    target: 'http://192.168.0.104:8188',                    // target: 'http://192.168.0.43:8081/',                    // target: 'https://www.gzchain.org.cn/managersvc/', //后端接口地址                    secure: false, //接受使用https                },            }        }    }})
 |