import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import basicSsl from '@vitejs/plugin-basic-ssl'

// https://vite.dev/config/
export default defineConfig({
  plugins: [react(), basicSsl(),],
  optimizeDeps: {
    include: ['echarts', 'echarts-for-react'],
  },
  server: {
    host: true,
    proxy: {
      '/graphql': {
        target: 'http://localhost:8080',
        changeOrigin: true,
        secure: false,
        rewrite: () => '/api/graphql',
      },
      '/api': {
        target: 'http://localhost:8080',
        changeOrigin: true,
        secure: false,
      },
      '/user': {
        target: 'http://192.168.1.179:8080',
        changeOrigin: true,
      },
      '/org': {
        target: 'http://192.168.1.179:8080',
        changeOrigin: true,
      },
      '/phone': {
        target: 'http://192.168.1.179:8080',
        changeOrigin: true,
      },
    },
  },
})
