/*
 * @Author: jixiang
 * @Date: 2021-04-07 11:06:09
 * @Description:
 * @FilePath: /vite-project/src/store/modules/index.ts
 * One World One Drefeel(56580223@qq.com)
 */
// https://vuex.vuejs.org/en/modules.html

// const files = require.context('.', true, /\.ts$/)
const modules: any = {};

const files: any = import.meta.globEager('./*/*.ts');


 Object.keys(files).forEach((key: string) => {
  if (key === './index.ts') return;
  const path = key.replace(/(\.\/|\.ts)/g, '');
  const [namespace, imported] = path.split('/');
  if (!modules[namespace]) {
    modules[namespace] = {
      namespaced: true,
    };
  }
   modules[namespace][imported] = files[key].default;
});
 
export default modules;
