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(), viteESLint()] } if (command === 'serve') { return { // serve配置 ...config, server:{ port: 3001, proxy:{ '/landcrm': { // target: 'http://114.215.254.174:8050/', target: 'https://ebeitest.wuyeface.com:1188/', // target: 'http://172.18.0.23/', changeOrigin: true, ws: true, rewrite: (path) => path.replace(/^\/landcrm/, '/landcrm') }, '/device': { // target: 'http://114.215.254.174:8050/', target: 'https://ebeitest.wuyeface.com:1188/', // target: 'http://172.18.1.40:8089/', // target: 'http://172.18.1.79:8089/', changeOrigin: true, ws: true, rewrite: (path) => path.replace(/^\/device/, '/device') }, } } } } else { return { // build配置 ...config } } }