jeecg-boot-vue3/mock/_createProductionServer.ts

19 lines
488 B
TypeScript
Raw Normal View History

2021-10-20 06:32:09 +00:00
import { createProdMockServer } from 'vite-plugin-mock/es/createProdMockServer';
const modules = import.meta.glob('./**/*.ts', { eager: true });
2021-10-20 06:32:09 +00:00
const mockModules: any[] = [];
Object.keys(modules).forEach((key) => {
if (key.includes('/_')) {
return;
}
mockModules.push(...(modules as Recordable)[key].default);
2021-10-20 06:32:09 +00:00
});
/**
* Used in a production environment. Need to manually import all modules
*/
export function setupProdMockServer() {
createProdMockServer(mockModules);
}