# install dependencies
pnpm i
# Run
pnpm dev
# Build product
pnpm build
本地开发时,通过 whistle 代理将线上域名指向本地服务,从而复用线上登录态,跳过 SSO 登录流程。
npm i whistle -g
启动 whistle 后打开 localhost:8899,新增规则:
# RT 预发
https://rt-admin.deploy-test.xiaopeng.com http://127.0.0.1:9980
whistle,代理服务器设置为 http://127.0.0.1:8899auto switch 下新增域名通配符规则,仅当域名为 rt-admin.deploy-test.xiaopeng.com 时触发代理在 .env 或对应环境配置文件中设置:
VITE_HTTP_PROXY = Y
将 serviceConfig 的开发环境 URL 指向预发域名:
serviceConfig.dev.url = 'https://rt-admin.deploy-test.xiaopeng.com'
在 vite.config.ts 的 server 配置中添加:
server: {
allowedHosts: true
}
w2 startauto switch 模式pnpm dev 启动本地服务https://rt-admin.deploy-test.xiaopeng.com,请求将被代理到本地,同时复用线上登录态