import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
const  path = require("path");

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [vue(),AutoImport({
    imports: [
      'vue',
      'vue-router',
      {
      '@/utils/cope': [
        'copeResponse'
      ]
    }]
  })],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src')
    },
  },
  server: {
    proxy: {
      '/api': {
        // target: 'http://127.0.0.1:4523/mock/859582',
        target: 'http://172.20.16.21:8080',
        changeOrigin: true,
        rewrite: path => path.replace(/^\/api/, ''),
      }
    },
    watch: {
      usePolling: true
    }
  }
})
