mirror of
https://github.com/vbenjs/gf-vben-admin.git
synced 2025-01-23 20:00:19 +08:00
19 lines
460 B
TypeScript
19 lines
460 B
TypeScript
import { createProdMockServer } from 'vite-plugin-mock/es/createProdMockServer';
|
|
|
|
const modules = import.meta.globEager('./**/*.ts');
|
|
|
|
const mockModules: any[] = [];
|
|
Object.keys(modules).forEach((key) => {
|
|
if (key.includes('/_')) {
|
|
return;
|
|
}
|
|
mockModules.push(...modules[key].default);
|
|
});
|
|
|
|
/**
|
|
* Used in a production environment. Need to manually import all modules
|
|
*/
|
|
export function setupProdMockServer() {
|
|
createProdMockServer(mockModules);
|
|
}
|