import { fileURLToPath, URL } from 'node:url'

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

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
  ],
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url))
    }
  },
  server: {
		host: "0.0.0.0",
		port: 5174,
		proxy: {
			'/api': {
				target: 'http://yijiyuyue/api', // 实际的API服务器地址
				changeOrigin: true,
				rewrite: (path) => path.replace(/^\/api/, '') // 如果API地址有前缀，可以进行转写
			}
		}
	}
})
