init
This commit is contained in:
40
vite.config.js
Normal file
40
vite.config.js
Normal file
@@ -0,0 +1,40 @@
|
||||
import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
|
||||
// https://vite.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
// 生产环境基础路径配置 - Vercel部署使用根路径
|
||||
base: "/",
|
||||
// 构建配置
|
||||
build: {
|
||||
outDir: "dist",
|
||||
// 启用 sourcemap 方便调试
|
||||
sourcemap: true,
|
||||
// 资源内联限制
|
||||
assetsInlineLimit: 4096,
|
||||
},
|
||||
// 开发服务器配置
|
||||
server: {
|
||||
host: "0.0.0.0",
|
||||
port: 5173,
|
||||
strictPort: true,
|
||||
// API代理配置
|
||||
proxy: {
|
||||
"/api": {
|
||||
target: "http://localhost:3000", // 本地开发用 localhost
|
||||
changeOrigin: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
// 预览服务器配置
|
||||
preview: {
|
||||
host: "0.0.0.0",
|
||||
port: 4173,
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
"@": "/src",
|
||||
},
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user