Skip to content

Commit

Permalink
refactor<mock>: compatibility notes (vbenjs#2555)
Browse files Browse the repository at this point in the history
  • Loading branch information
luocong2016 authored Feb 22, 2023
1 parent 5335ae7 commit a222404
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions mock/_createProductionServer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
import { createProdMockServer } from 'vite-plugin-mock/es/createProdMockServer';

// 问题描述
// 1. `import.meta.globEager` 已被弃用, 需要升级vite版本,有兼容问题
// 2. `vite-plugin-mock` 插件问题 https://github.com/vbenjs/vite-plugin-mock/issues/56

// const modules: Record<string, any> = import.meta.glob("./**/*.ts", {
// import: "default",
// eager: true,
// });

// const mockModules = Object.keys(modules).reduce((pre, key) => {
// if (!key.includes("/_")) {
// pre.push(...modules[key]);
// }
// return pre;
// }, [] as any[]);

const modules = import.meta.globEager('./**/*.ts');

const mockModules: any[] = [];
Expand Down

0 comments on commit a222404

Please sign in to comment.