diff --git a/README.md b/README.md index f3d2673..85825e8 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ cp .env.example .env pnpm dev ``` -浏览器访问 http://localhost:5173。先在后端仓库启动 `pnpm dev`,默认监听 **3412**。 +浏览器访问 http://localhost:4312。开发服务器会监听所有网卡,并在启动日志中输出局域网 IP;先在后端仓库启动 `pnpm dev`,默认监听 **3412**。 ```dotenv VITE_API_BASE_URL=/api diff --git a/vite.config.ts b/vite.config.ts index 27a1e75..b0869a5 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -10,7 +10,9 @@ export default defineConfig(({ mode }) => { plugins: [vue(), tailwindcss()], resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } }, server: { - port: 5173, + /** 监听所有网卡,使 Vite 启动时输出可访问的局域网 IP。 */ + host: true, + port: 4312, proxy: { '/api': { target: env.API_PROXY_TARGET || 'http://localhost:3412',