Commit a2224042206c3b06dbe2fcbccd8565f11480f58f

Authored by luocong2016
Committed by GitHub
1 parent 5335ae75

refactor<mock>: compatibility notes (#2555)

Showing 1 changed file with 16 additions and 0 deletions
mock/_createProductionServer.ts
1 1 import { createProdMockServer } from 'vite-plugin-mock/es/createProdMockServer';
2 2  
  3 +// 问题描述
  4 +// 1. `import.meta.globEager` 已被弃用, 需要升级vite版本,有兼容问题
  5 +// 2. `vite-plugin-mock` 插件问题 https://github.com/vbenjs/vite-plugin-mock/issues/56
  6 +
  7 +// const modules: Record<string, any> = import.meta.glob("./**/*.ts", {
  8 +// import: "default",
  9 +// eager: true,
  10 +// });
  11 +
  12 +// const mockModules = Object.keys(modules).reduce((pre, key) => {
  13 +// if (!key.includes("/_")) {
  14 +// pre.push(...modules[key]);
  15 +// }
  16 +// return pre;
  17 +// }, [] as any[]);
  18 +
3 19 const modules = import.meta.globEager('./**/*.ts');
4 20  
5 21 const mockModules: any[] = [];
... ...