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

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue()],
  base: '/government/', // 设置基础路径
  resolve: {
    alias: {
      '@': '/src',
      'antd': 'ant-design-vue'
    }
  },
  server: {
    port: 3002,
    proxy: {
      '/api': {
        target: 'http://localhost:5352', // 政府端后端服务地址
        changeOrigin: true
      }
    }
  },
  build: {
    outDir: 'dist',
    assetsDir: 'assets',
    sourcemap: false,
    rollupOptions: {
      output: {
        manualChunks: {
          vendor: ['vue', 'vue-router', 'ant-design-vue'],
          echarts: ['echarts', 'vue-echarts']
        }
      }
    }
  }
})