import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import VueDevTools from 'vite-plugin-vue-devtools'
import path from 'path'
import WindiCSS from 'vite-plugin-windicss'

export default defineConfig({
  resolve: {
    alias: {
      '@': path.resolve(__dirname,'src')
    }
  },
  server: {
    open: true,
    cors: true,
    allowedHosts: ['.jifuyun.cn'],
    proxy: {
      '/api': {
        target: 'https://api.jifuyun.cn/',
        changeOrigin: true,
        rewrite: (p) => p.replace(/^\/api/, '')
      }
    }
  },
  plugins: [
    vue(),
    VueDevTools(),
    WindiCSS()
  ],
})
