From 1d707e4ab6b619d3a2ca8e9bee10f566e240ae7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=BB=E7=BE=BD=E9=A3=9E?= Date: Mon, 6 Jan 2020 22:22:37 +0800 Subject: [PATCH] perf: import mockXHR only in production (#2910) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 自动排除mock 生产环境,使用webpack的条件编译自动排除mock数据 * perf: refine Co-authored-by: 花裤衩 --- src/main.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main.js b/src/main.js index e218bd83..b00b3715 100644 --- a/src/main.js +++ b/src/main.js @@ -26,11 +26,12 @@ import * as filters from './filters' // global filters * you can execute: mockXHR() * * Currently MockJs will be used in the production environment, - * please remove it before going online! ! ! + * please remove it before going online ! ! ! */ -import { mockXHR } from '../mock' if (process.env.NODE_ENV === 'production') { - mockXHR() + import('../mock').then(({ mockXHR }) => { + mockXHR() + }) } Vue.use(Element, {