自动排除mock

生产环境,使用webpack的条件编译自动排除mock数据
This commit is contained in:
任羽飞
2020-01-06 16:39:25 +08:00
committed by GitHub
parent 4f563a7bfe
commit 81db6b876f

View File

@@ -24,11 +24,9 @@ import * as filters from './filters' // global filters
* you want to use MockJs for mock api * you want to use MockJs for mock api
* you can execute: mockXHR() * you can execute: mockXHR()
* *
* Currently MockJs will be used in the production environment,
* please remove it before going online! ! !
*/ */
import { mockXHR } from '../mock'
if (process.env.NODE_ENV === 'production') { if (process.env.NODE_ENV === 'production') {
const { mockXHR } = require('../mock').default
mockXHR() mockXHR()
} }