import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' import path from 'path' export default defineConfig({ plugins: [react()], base: '/', server: { port: 3000, open: true, host: true, // 如果有跨域需求,可以添加代理配置 // proxy: { // '/api': { // target: 'your-api-url', // changeOrigin: true, // rewrite: (path) => path.replace(/^\/api/, '') // } // } }, resolve: { alias: { "@": path.resolve(__dirname, "./src"), }, }, build: { target: 'esnext', minify: 'esbuild', assetsDir: 'assets', // 静态资源目录 outDir: 'dist' } })