import { defineConfig } from '@vben/vite-config';

export default defineConfig(async () => {
  return {
    application: {},
    vite: {
      optimizeDeps: {
        exclude: [
          '@vben/plugins/echarts',
          'echarts',
        ],
      },
      server: {
        proxy: {
          '/api': {
            changeOrigin: true,
            rewrite: (path) => path.replace(/^\/api/, ''),
            // mock代理目标地址
            // target: 'https://api.xiaokang88.com/api/admin/',
            target: 'http://localhost:18001/api/admin/',
            // target: 'http://api.xiaokang88.com/api/admin/',
            ws: true,
          },
          '/im-api': {
            changeOrigin: true,
            rewrite: (path) => path.replace(/^\/im-api/, ''),
            // mock代理目标地址
            // target: 'https://api.xiaokang88.com/api/admin/',
            // target: 'https://api.ws.g.xiaokang88.com/api/',
            target: 'http://localhost:12080/api/',
            // target: 'http://api.xiaokang88.com/api/admin/',
            ws: true,
          },
        },
      },
    },
  };
});
