import { reactive } from 'vue'
export interface StaticImg {
  logo: string
  blue: string
  boardBg: string
  boardFour: string
  boardSix: string
  green: string
  orange: string
  purple: string
  red: string
  yellow: string
  dire: string
}

const modules = import.meta.glob('/src/assets/*', {eager: true, })
let staticImg: Partial<StaticImg> = {}
try {
  Object.keys(modules).forEach( key => {
    const regex = /\/(\w+)\.\w+$/;
    const match = key.match(regex);
    const fileName: keyof StaticImg = match![1] as keyof StaticImg;
    staticImg[fileName] = `${key}`
    // staticImg[fileName] = new URL(key.replace('/src', '@'), import.meta.url).href
  })
} catch (error) {
  // console.log(error);
  // throw new Error(error);
  
  console.error("请检查assets文件下的图片资源命名是否符合驼峰规范:", JSON.stringify(error));
}



staticImg.boardBg = `http://nginx.test.luojigou.vip:8899/0/file/1637996006995918849.png`

export default reactive(staticImg)
