Commit e5cd8253 authored by nikogu's avatar nikogu

增加禁用 proxy 的 start

parent 5e0d8684
...@@ -8,8 +8,10 @@ import { getProfileAdvancedData } from './mock/profile'; ...@@ -8,8 +8,10 @@ import { getProfileAdvancedData } from './mock/profile';
import { getNotices } from './mock/notices'; import { getNotices } from './mock/notices';
import { format, delay } from 'roadhog-api-doc'; import { format, delay } from 'roadhog-api-doc';
// 代码中会兼容本地 service mock 以及部署站点的静态数据 // 是否禁用代理
const noProxy = process.env.NO_PROXY === 'true';
// 代码中会兼容本地 service mock 以及部署站点的静态数据
const proxy = { const proxy = {
// 支持值为 Object 和 Array // 支持值为 Object 和 Array
'GET /api/currentUser': { 'GET /api/currentUser': {
...@@ -79,4 +81,4 @@ const proxy = { ...@@ -79,4 +81,4 @@ const proxy = {
'GET /api/notices': getNotices, 'GET /api/notices': getNotices,
}; };
export default delay(proxy, 1000); export default noProxy ? {} : delay(proxy, 1000);
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
"scripts": { "scripts": {
"precommit": "npm run lint", "precommit": "npm run lint",
"start": "roadhog server", "start": "roadhog server",
"start:no-proxy": "NO_PROXY=true roadhog server",
"build": "roadhog build", "build": "roadhog build",
"site": "roadhog-api-doc static", "site": "roadhog-api-doc static",
"lint:style": "stylelint \"src/**/*.less\" --syntax less", "lint:style": "stylelint \"src/**/*.less\" --syntax less",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment