perf: import mockXHR only in production (#2910)

* 自动排除mock

生产环境,使用webpack的条件编译自动排除mock数据

* perf: refine

Co-authored-by: 花裤衩 <panfree23@gmail.com>
This commit is contained in:
任羽飞 2020-01-06 22:22:37 +08:00 committed by 花裤衩
parent 4f563a7bfe
commit a0b39d5043
1 changed files with 4 additions and 3 deletions

View File

@ -25,11 +25,12 @@ import * as filters from './filters' // global filters
* you can execute: mockXHR() * you can execute: mockXHR()
* *
* Currently MockJs will be used in the production environment, * 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') { if (process.env.NODE_ENV === 'production') {
mockXHR() import('../mock').then(({ mockXHR }) => {
mockXHR()
})
} }
Vue.use(Element, { Vue.use(Element, {