diff --git a/packages/fes-cli/build/helpers/createDevServer.js b/packages/fes-cli/build/helpers/createDevServer.js index eef03686..ec57707c 100644 --- a/packages/fes-cli/build/helpers/createDevServer.js +++ b/packages/fes-cli/build/helpers/createDevServer.js @@ -17,9 +17,6 @@ module.exports = function createDevServer(port, defaultConfig) { const app = express(); - // 初始化Mock数据 - createMock(app); - const compiler = webpack(defaultConfig); // devServer 自带支持,添加自定义插件。 @@ -43,6 +40,8 @@ module.exports = function createDevServer(port, defaultConfig) { })); app.use('/static', express.static('src/static')); + // 初始化Mock数据 + createMock(app); opn(`http://localhost:${port}`); diff --git a/packages/fes-cli/build/helpers/createMock.js b/packages/fes-cli/build/helpers/createMock.js index fcf226ec..d12f22d9 100644 --- a/packages/fes-cli/build/helpers/createMock.js +++ b/packages/fes-cli/build/helpers/createMock.js @@ -15,7 +15,6 @@ const util = require('./util'); const router = express.Router(); - // 根据参数个数获取配置 function getOption(arg) { const len = arg.length; @@ -145,9 +144,6 @@ const createMock = function () { proxy.on('error', (e) => { log.error(e); }); - proxy.on('proxyReq', (proxyReq) => { - proxyReq.setHeader('Host', url.parse(host).host); - }); process.nextTick(() => { router.use((req, res) => { proxy.web(req, res, { diff --git a/packages/fes-cli/package.json b/packages/fes-cli/package.json index 4d7fd72c..4753b1c6 100644 --- a/packages/fes-cli/package.json +++ b/packages/fes-cli/package.json @@ -1,6 +1,6 @@ { "name": "@webank/fes-cli", - "version": "0.4.7", + "version": "0.4.8", "description": "一个好用的前端管理台快速开发框架", "preferGlobal": true, "scripts": {