import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import viteESLint from '@ehutch79/vite-eslint' import path from 'path' export default ({ command, mode }) => { let config = { alias:{ '@': path.resolve(__dirname, 'src'), 'api': path.resolve(__dirname, 'src/api'), 'comps': path.resolve(__dirname, 'src/components'), 'css': path.resolve(__dirname, 'src/assets/css'), 'images': path.resolve(__dirname, 'src/assets/images'), 'router': path.resolve(__dirname, 'src/router'), 'utils': path.resolve(__dirname, 'src/utils'), }, base: './', plugins: [ vue() ] } if (command === 'serve') { return { // serve配置 ...config, server:{ port: 3001, proxy:{ '/landcrm': { target: 'http://172.18.0.23/', // target: 'https://ebeitest.wuyeface.com:1188/', // target: 'http://101.200.225.123/', changeOrigin: true, ws: true, rewrite: (path) => path.replace(/^\/landcrm/, '/landcrm') }, '/device': { target: 'http://172.18.0.23/', // target: 'https://ebeitest.wuyeface.com:1188/', // target: 'http://101.200.225.123/', changeOrigin: true, ws: true, rewrite: (path) => path.replace(/^\/device/, '/device') }, '/hospital': { // target: 'http://172.18.0.23/', // target: 'http://172.18.0.78:9090/', target: 'http://172.18.1.79:9091/', // target: 'https://ebeitests.wuyeface.com:1188/', // target: 'http://101.200.225.123/', changeOrigin: true, ws: true, rewrite: (path) => path.replace(/^\/hospital/, '/hospital') }, } } } } else { return { // build配置 ...config } } }