fix: plugin-mock只在development时启用

plugin-mock中的api.onStart的watch会导致进程不会退出
This commit is contained in:
万纯 2021-03-01 12:31:41 +08:00
parent dfb6af946c
commit d580e25bd0
2 changed files with 3 additions and 3 deletions

View File

@ -17,7 +17,8 @@ export default (api) => {
schema(joi) {
return joi.alternatives(joi.boolean(), joi.object());
}
}
},
enableBy: () => process.env.NODE_ENV === 'development'
});
// 对 array、object 遍历处理
@ -149,7 +150,7 @@ export default (api) => {
if (!mockFlag) return;
loadMock = createMock();
chokidar.watch(mockFile, {
return chokidar.watch(mockFile, {
ignoreInitial: true
}).on('change', () => {
api.logger.info('mock.js changedreload');

View File

@ -56,7 +56,6 @@ const args = yParser(rawArgv);
args,
rawArgv
});
process.exit(0);
}
} catch (e) {
console.error(chalk.red(e.message));