导入功能调整

This commit is contained in:
fofolee
2022-04-05 10:10:28 +08:00
parent f101fced6d
commit b16087d270
10 changed files with 241 additions and 88 deletions

View File

@@ -1,15 +1,15 @@
/**
* 快速导入同一目录下的所有脚本
*/
*/
const importAll = context => {
const map = {}
for (const key of context.keys()) {
const keyArr = key.split('/')
keyArr.shift()
map[keyArr.join('.').replace(/\.js$/g, '')] = context(key)
map[keyArr.join('.').replace(/\.\w+$/g, '')] = context(key)
}
return map
}
export default importAll
export default importAll