Skip to content

Latest commit

 

History

History
63 lines (51 loc) · 1.12 KB

项目使用指南.md

File metadata and controls

63 lines (51 loc) · 1.12 KB

项目使用指南

如何开始

yarn install
# 开发模式启动,需在serve中配置代理地址
yarn run start
# 生产模式启动
yarn run start:production
# mock模式启动,适配 antd pro mock
yarn run start:mock
# 非proxy模式启动
yarn run start:noproxy
# 需经过eslint校验
yarn run build
# 无需经过eslint校验
yarn run build:nolint
# 运行单元测试
yarn run test

代理配置

var options = {
  target: 'http://www.example.org', // target host
  changeOrigin: true, // needed for virtual hosted sites
  ws: true, // proxy websockets
  pathRewrite: {
    '^/api/old-path': '/api/new-path', // rewrite path
    '^/api/remove/path': '/path', // remove base path
  },
  router: {
    // when request.headers.host == 'dev.localhost:3000',
    // override target 'http://www.example.org' to 'http://localhost:8000'
    'dev.localhost:3000': 'http://localhost:8000',
  },
};

参考资料:https://github.com/chimurai/http-proxy-middleware