import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import path from 'path' // https://vite.dev/config/ export default defineConfig({ base: './', plugins: [vue()], resolve: { alias: { '@': path.resolve(__dirname, './src') } }, server: { port: '8080', proxy: { '/apiV1': { // 配置需要代理的路径 target: 'https://www.workark.com', // 目标地址 --> 服务器地址 changeOrigin: true, // 允许跨域 ws: true, // 允许websocket代理 // 重写路径 --> 作用与vue配置pathRewrite作用相同 rewrite: (path) => path.replace(/^\/apiV1/, "") }, '/difyAPI': { // 配置需要代理的路径 target: 'http://203.110.233.149:9000', // 目标地址 --> 服务器地址 changeOrigin: true, // 允许跨域 ws: true, // 允许websocket代理 // 重写路径 --> 作用与vue配置pathRewrite作用相同 rewrite: (path) => path.replace(/^\/difyAPI/, "") } }, } })