import { defineConfig, loadEnv } from 'vite'; import vue from '@vitejs/plugin-vue'; import vueDevTools from 'vite-plugin-vue-devtools'; // https://vitejs.dev/config/ export default defineConfig(({ mode }) => { // const env = loadEnv(mode, process.cwd()); return { /** * 项目根目录 * @see https://cn.vite.dev/config/shared-options.html#root */ root: './src', /** * 静态资源目录,相对于 src/index.html 文件 * @see https://cn.vite.dev/config/shared-options.html#publicdir */ publicDir: '../public', server: { port: 5173, host: '0.0.0.0', // IP配置,支持从IP启动 proxy: { '/api/': { target: 'http://smartai.com:8401', // target: 'http://192.168.20.119:9301', changeOrigin: true, secure: false, ws: true, cors: true, rewrite: (path) => path.replace(/^\/proxy_url/, '') }, '/dify': { target: 'http://192.168.20.119:28003/', changeOrigin: true, secure: false, ws: true, rewrite: (path) => path.replace(/^\/dify/, '') }, '/rgflow': { target: 'http://192.168.20.119:28002/', changeOrigin: true, secure: false, ws: true, rewrite: (path) => path.replace(/^\/rgflow/, '') } } }, build: { /** * 构建输出目录,相对于 src/index.html 文件 * @see https://cn.vite.dev/config/build-options.html#build-outdir */ outDir: '../dist', emptyOutDir: true }, plugins: [ vue(), /** * @see https://devtools.vuejs.org/guide/vite-plugin */ vueDevTools({ launchEditor: 'code' }) ] }; });