move option for enable/disable mock/mock-erver to .env.* file

This commit is contained in:
RoBlues
2020-02-03 19:01:09 +08:00
parent 4ff36f1d84
commit 0a4b206c41
5 changed files with 68 additions and 3 deletions

View File

@@ -27,7 +27,10 @@ import * as filters from './filters' // global filters
* Currently MockJs will be used in the production environment,
* please remove it before going online ! ! !
*/
if (process.env.NODE_ENV === 'production') {
/**
* VUE_APP_MOCK is defined in .env.production or .env.development
*/
if (process.env.VUE_APP_MOCK === 'Mock') {
const { mockXHR } = require('../mock')
mockXHR()
}