cmc-web/packages/common/components/icon-select/svgIcons.ts

27 lines
683 B
TypeScript
Raw Normal View History

2024-08-20 12:11:31 +00:00
/*
* @Author: Haijun Zhang
* @Date: 2022-11-03 15:41:09
* @LastEditTime: 2022-11-07 10:39:26
* @LastEditors: Haijun Zhang
2024-08-21 01:17:14 +00:00
* @Description:
2024-08-20 12:11:31 +00:00
* @FilePath: \cmc-web\node_modules\@cmc\common\components\icon-select\svgIcons.ts
*/
// webpack
const req = require.context('@/icons/svg', false, /\.svg$/)
const requireAll = (requireContext: any) => requireContext.keys()
2024-08-21 01:17:14 +00:00
const re = /\.\/(.*)\.svg/
2024-08-20 12:11:31 +00:00
const svgIcons = requireAll(req).map((i: any) => {
return i.match(re)[1]
})
// vite
// const req = import.meta.globEager('/src/icons/svg/*.svg')
// const re = /\/svg\/(.*)\.svg/
// const svgIcons = Object.keys(req).map(i => {
// return i.match(re)[1]
// })
export default svgIcons