feat: 配置局域网IP访问与4312端口
This commit is contained in:
@@ -21,7 +21,7 @@ cp .env.example .env
|
|||||||
pnpm dev
|
pnpm dev
|
||||||
```
|
```
|
||||||
|
|
||||||
浏览器访问 http://localhost:5173。先在后端仓库启动 `pnpm dev`,默认监听 **3412**。
|
浏览器访问 http://localhost:4312。开发服务器会监听所有网卡,并在启动日志中输出局域网 IP;先在后端仓库启动 `pnpm dev`,默认监听 **3412**。
|
||||||
|
|
||||||
```dotenv
|
```dotenv
|
||||||
VITE_API_BASE_URL=/api
|
VITE_API_BASE_URL=/api
|
||||||
|
|||||||
+3
-1
@@ -10,7 +10,9 @@ export default defineConfig(({ mode }) => {
|
|||||||
plugins: [vue(), tailwindcss()],
|
plugins: [vue(), tailwindcss()],
|
||||||
resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } },
|
resolve: { alias: { '@': fileURLToPath(new URL('./src', import.meta.url)) } },
|
||||||
server: {
|
server: {
|
||||||
port: 5173,
|
/** 监听所有网卡,使 Vite 启动时输出可访问的局域网 IP。 */
|
||||||
|
host: true,
|
||||||
|
port: 4312,
|
||||||
proxy: {
|
proxy: {
|
||||||
'/api': {
|
'/api': {
|
||||||
target: env.API_PROXY_TARGET || 'http://localhost:3412',
|
target: env.API_PROXY_TARGET || 'http://localhost:3412',
|
||||||
|
|||||||
Reference in New Issue
Block a user