import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react-swc'
import { fileURLToPath, URL } from 'node:url'
import mkcert from 'vite-plugin-mkcert'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react(), mkcert()],
  server: {
    open: true,
    host: 'dev.ezijing.com',
    proxy: {
      // '/api/resource/bi': {
      //   target: 'https://saas-lab.ezijing.com',
      //   changeOrigin: true,
      //   rewrite: (path) => path.replace(/^\/api\/bi/, '/api/resource/bi'),
      // },
      // '/api/resource/bi': 'https://saas-lab.ezijing.com/api/resource/bi',
      '/api': 'https://saas-lab.ezijing.com',
    },
  },
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),
    },
  },
})
