Skip to content

Commit a0b39d5

Browse files
MillerRenPanJiaChen
andcommitted
perf: import mockXHR only in production (PanJiaChen#2910)
* 自动排除mock 生产环境,使用webpack的条件编译自动排除mock数据 * perf: refine Co-authored-by: 花裤衩 <[email protected]>
1 parent 4f563a7 commit a0b39d5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ import * as filters from './filters' // global filters
2525
* you can execute: mockXHR()
2626
*
2727
* Currently MockJs will be used in the production environment,
28-
* please remove it before going online! ! !
28+
* please remove it before going online ! ! !
2929
*/
30-
import { mockXHR } from '../mock'
3130
if (process.env.NODE_ENV === 'production') {
32-
mockXHR()
31+
import('../mock').then(({ mockXHR }) => {
32+
mockXHR()
33+
})
3334
}
3435

3536
Vue.use(Element, {

0 commit comments

Comments
 (0)