123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- 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://www.gzjlzhwy.com:4433/',
- changeOrigin: true,
- ws: true,
- rewrite: (path) => path.replace(/^\/landcrm/, '/landcrm')
- },
- '/device': {
- target: 'https://www.gzjlzhwy.com:4433/',
- changeOrigin: true,
- ws: true,
- rewrite: (path) => path.replace(/^\/device/, '/device')
- },
- '/attendance': {
- target: 'https://www.gzjlzhwy.com:4433/',
- changeOrigin: true,
- ws: true,
- rewrite: (path) => path.replace(/^\/attendance/, '/attendance')
- },
- }
- }
- }
- } else {
- return {
- // build配置
- ...config
- }
- }
- }
|