diff --git a/.roadhogrc.mock.js b/.roadhogrc.mock.js index 89fdc8e40407c2d4e98fd7ae015d8c230d2f32c0..3fabce2ea2179c219cfdddb98e05b42af766b7ab 100644 --- a/.roadhogrc.mock.js +++ b/.roadhogrc.mock.js @@ -8,8 +8,10 @@ import { getProfileAdvancedData } from './mock/profile'; import { getNotices } from './mock/notices'; import { format, delay } from 'roadhog-api-doc'; -// 代码中会兼容本地 service mock 以及部署站点的静态数据 +// 是否禁用代理 +const noProxy = process.env.NO_PROXY === 'true'; +// 代码中会兼容本地 service mock 以及部署站点的静态数据 const proxy = { // 支持值为 Object 和 Array 'GET /api/currentUser': { @@ -79,4 +81,4 @@ const proxy = { 'GET /api/notices': getNotices, }; -export default delay(proxy, 1000); +export default noProxy ? {} : delay(proxy, 1000); diff --git a/package.json b/package.json index 50a364939567f7cfe69b17570e6dd4bb96461dc2..6cd21c00e0f66fc2836002d71052b58192be632f 100755 --- a/package.json +++ b/package.json @@ -4,6 +4,7 @@ "scripts": { "precommit": "npm run lint", "start": "roadhog server", + "start:no-proxy": "NO_PROXY=true roadhog server", "build": "roadhog build", "site": "roadhog-api-doc static", "lint:style": "stylelint \"src/**/*.less\" --syntax less",