Skip to content

Commit 1d707e4

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

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
@@ -26,11 +26,12 @@ import * as filters from './filters' // global filters
2626
* you can execute: mockXHR()
2727
*
2828
* Currently MockJs will be used in the production environment,
29-
* please remove it before going online! ! !
29+
* please remove it before going online ! ! !
3030
*/
31-
import { mockXHR } from '../mock'
3231
if (process.env.NODE_ENV === 'production') {
33-
mockXHR()
32+
import('../mock').then(({ mockXHR }) => {
33+
mockXHR()
34+
})
3435
}
3536

3637
Vue.use(Element, {

0 commit comments

Comments
 (0)