You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
331 B
17 lines
331 B
|
3 years ago
|
// 批量导出文件
|
||
|
|
const requireApi = require.context(
|
||
|
|
// api 目录的相对路径
|
||
|
|
'.',
|
||
|
|
// 是否查询子目录
|
||
|
|
false,
|
||
|
|
// 查询文件的一个后缀
|
||
|
|
/.js$/
|
||
|
|
)
|
||
|
|
|
||
|
|
let module = {}
|
||
|
|
requireApi.keys().forEach((key, index)=>{
|
||
|
|
if (key === './index.js') return;
|
||
|
|
Object.assign(module, requireApi(key));
|
||
|
|
})
|
||
|
|
|
||
|
|
export default module;
|