修改docker-compose.dev
This commit is contained in:
@@ -4,7 +4,8 @@ VITE_PORT=5678
|
||||
VITE_BASE=/
|
||||
|
||||
# 接口地址
|
||||
VITE_GLOB_API_URL=http://127.0.0.1:8000/api
|
||||
VITE_GLOB_API_URL=/api
|
||||
VITE_BACKEND_URL=http://localhost:8000
|
||||
|
||||
# 是否开启 Nitro Mock服务,true 为开启,false 为关闭
|
||||
VITE_NITRO_MOCK=false
|
||||
|
||||
1
web/apps/web-antd/.env.docker
Normal file
1
web/apps/web-antd/.env.docker
Normal file
@@ -0,0 +1 @@
|
||||
VITE_BACKEND_URL=http://backend:8000
|
||||
@@ -1,17 +1,20 @@
|
||||
import { defineConfig } from '@vben/vite-config';
|
||||
|
||||
export default defineConfig(async () => {
|
||||
import { loadEnv } from 'vite';
|
||||
|
||||
export default defineConfig(async ({ mode }) => {
|
||||
// eslint-disable-next-line n/prefer-global/process
|
||||
const env = loadEnv(mode, process.cwd(), '');
|
||||
return {
|
||||
application: {},
|
||||
vite: {
|
||||
server: {
|
||||
host: '0.0.0.0', // 保证 docker 内外都能访问
|
||||
port: 5678,
|
||||
proxy: {
|
||||
'/api': {
|
||||
target: env.VITE_BACKEND_URL,
|
||||
changeOrigin: true,
|
||||
rewrite: (path) => path.replace(/^\/api/, ''),
|
||||
// mock代理目标地址
|
||||
target: 'http://localhost:5320/api',
|
||||
ws: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user