From 248104104b68ca280f80c94cc96bf57328388c83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8A=B1=E8=A3=A4=E8=A1=A9?= Date: Sun, 2 Feb 2020 19:37:33 +0800 Subject: [PATCH] update --- mock/mock-server.js | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/mock/mock-server.js b/mock/mock-server.js index 873d7bc4..806fdacc 100644 --- a/mock/mock-server.js +++ b/mock/mock-server.js @@ -2,22 +2,10 @@ const chokidar = require('chokidar') const bodyParser = require('body-parser') const chalk = require('chalk') const path = require('path') +const Mock = require('mockjs') const mockDir = path.join(process.cwd(), 'mock') -const Mock = require('mockjs') - -/** - * 修订说明:把mock文件夹下面的文件功能进行梳理 - * - * 1. /mock/index.js输出mockXHR()函数,使用改写 - * XMLHttpRequest对象的方式,在浏览器中拦截请求,返回响应 - * - * 2. /mock/mock-server.js引用/mock/index.js中导出的 - * mocks数据(未经responseFake转换),自行加工后作为 - * devServer启动的express应用的路由,从而实现真正的后台 - * api服务 - */ function registerRoutes(app) { let mockLastIndex const { default: mocks } = require('./index.js') @@ -54,6 +42,7 @@ const responseFake = (url, type, respond) => { } } } + module.exports = app => { // es6 polyfill require('@babel/register')