import { defineConfig } from 'vite' import vue from '@vitejs/plugin-vue' import vueJsx from '@vitejs/plugin-vue-jsx' import path from 'path' const nodeResolve = (dir: string) => path.resolve(__dirname, '.', dir) // https://vitejs.dev/config/ export default defineConfig({ plugins: [vue(), vueJsx()], server: { host: '0.0.0.0', open: true, proxy: { '/api': { // target: 'http://192.168.1.81:10215', //数据中心 // target: 'http://192.168.1.24:10215', // // target: 'http://192.168.1.122:10215', //gfh // target: 'http://192.168.1.127:10215', //cdf // target: 'http://192.168.1.125:10215', target: 'http://192.168.1.103:10215', // target: 'https://pqmcn.com:8092/api', //治理 // target:'http://www.zhilitest.com:8089/api', changeOrigin: true, rewrite: path => path.replace(/^\/api/, '') //路径重写,把'/api'替换为'' } } // port:'3000' }, resolve: { alias: { '@': nodeResolve('src'), '~': nodeResolve('public') } } })