mockProdServer.ts 381 B

12345678910
  1. import { createProdMockServer } from 'vite-plugin-mock/es/createProdMockServer'
  2. // import.meta.glob 进行全部导入
  3. const modulesFiles:any= import.meta.globEager('../mock/*.ts')
  4. let modules: Array<any> = []
  5. for (const path in modulesFiles) {
  6. modules = modules.concat(modulesFiles[path].default)
  7. }
  8. export function setupProdMockServer() {
  9. createProdMockServer([...modules])
  10. }