相关疑难解决方法(0)

react-fontawesome 导入所有图标

I'm trying to import just the fontawesome icons I need as the full library is 3mb. I've swapped to the fontawesome-react component to enable this but I'm not having much luck.

Here's my test case:

Package includes:

"@fortawesome/fontawesome-svg-core": "^1.2.4",
"@fortawesome/pro-regular-svg-icons": "^5.3.1",
"@fortawesome/react-fontawesome": "^0.1.3",
Run Code Online (Sandbox Code Playgroud)

Component:

import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faThumbsUp } from '@fortawesome/pro-regular-svg-icons';

// In Render:
<FontAwesomeIcon
    icon={ faThumbsUp }
/>
Run Code Online (Sandbox Code Playgroud)

Results in an include size of 1MB Is this expected behaviour?

It appears to be following …

font-awesome reactjs font-awesome-5

7
推荐指数
3
解决办法
4528
查看次数

标签 统计

font-awesome ×1

font-awesome-5 ×1

reactjs ×1