#12649·umi

[Feature Request] 封装 Icon 组件后,也能正常检测到本地图标

Author: haohaioCreated Aug 17, 2024Updated Jun 2, 2026
Labelstype(enhancement)

Background

想要像字体图标一样使用 Icon, 故对 Icon 组件进行了封装,但会导致无法检测到本地图标

typescript
import type { ComponentProps } from 'react';
import { Icon } from 'umi';

const MyIcon: React.FC<ComponentProps<typeof Icon>> = (props) => {
  return <Icon width="1em" height="1em" fill="currentColor" {...props} />;
};

export default MyIcon;
typescript
<MyIcon icon="local:home" className="text-[12px] text-[red]" />

Proposal

封装了 Icon 组件后,也能正常检测到本地图标。或者支持 icons: { include: ['local:*'] } 这样的配置...