// import Vue from 'vue'

import SvgIcon from '../components/svg-icon'// svg component

// register globally
// Vue.component('svg-icon', SvgIcon)

// const req = import.meta.globEager("./svg/*.svg")
// console.log(req)
// // const requireAll = (requireContext: any) => requireContext.keys().map(requireContext)
// const requireAll = (requireContext: any) => {
//   return requireContext.keys().map(requireContext)
// }
// requireAll(req)

const files = import.meta.globEager("./svg/*.svg")

let modules: any = {}
for (const key in files) {
    modules[key.replace(/(\.\/module\/|\.js)/g, '')] = files[key].default
}

Object.keys(modules).forEach(item => {
    modules[item] = true
})
console.log(modules)
// const requireAll = (requireContext: any) => {
//   return requireContext.keys().map(requireContext)
// }
// requireAll(modules)

export default {
  install(Vue: any) {
    Vue.component('svg-icon', SvgIcon)
  }
}
