12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- 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: 'https://wuye.djchina.com/',
- target: 'https://ebeitest.wuyeface.com:1188/',
- changeOrigin: true,
- ws: true,
- rewrite: (path) => path.replace(/^\/landcrm/, '/landcrm')
- },
- '/neikong': {
- // target: 'https://wuye.djchina.com/',
- target: 'https://ebeitest.wuyeface.com:1188/',
- changeOrigin: true,
- ws: true,
- rewrite: (path) => path.replace(/^\/neikong/, '/neikong')
- },
- '/datashow': {
- // target: 'https://wuye.djchina.com/',
- target: 'https://ebeitest.wuyeface.com:1188/',
- changeOrigin: true,
- ws: true,
- rewrite: (path) => path.replace(/^\/datashow/, '/datashow')
- },
- '/video': {
- // target: 'https://wuye.djchina.com/',
- target: 'http://172.18.0.76:9009/',
- changeOrigin: true,
- ws: true,
- rewrite: (path) => path.replace(/^\/video/, '/video')
- },
- }
- }
- }
- } else {
- return {
- // build配置
- ...config
- }
- }
- }
|