import react from '@vitejs/plugin-react';
import { defineConfig } from 'vite';

const apiProxyTarget = process.env.VITE_API_PROXY_TARGET || 'http://115.29.187.205:20300';

export default defineConfig({
  plugins: [react()],
  worker: {
    format: 'es'
  },
  server: {
    proxy: {
      '/api': { target: apiProxyTarget, changeOrigin: true },
      '/_AMapService': { target: apiProxyTarget, changeOrigin: true }
    }
  },
  test: {
    environment: 'jsdom',
    setupFiles: './src/test/setup.ts'
  }
});
