主题
fast-glob-批量获取文件
javascript
import fg from "fast-glob";
import { resolve } from "path";
fg("./demos/**/*")
.then((res) => {
console.log(res);
return Promise.all(
res.map(async (path) => {
const mod = await import(resolve(process.cwd(), path));
return [path, mod];
})
);
})
.then((res) => {
console.log(res);
});