Skip to content

Commit

Permalink
perf: import mockXHR only in production (PanJiaChen#2910)
Browse files Browse the repository at this point in the history
* 自动排除mock

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

* perf: refine

Co-authored-by: 花裤衩 <panfree23@gmail.com>
  • Loading branch information
2 people authored and sunshine17 committed Feb 11, 2020
1 parent 8b7a136 commit 7b92c40
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,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, {
Expand Down

0 comments on commit 7b92c40

Please sign in to comment.