Fontawesome 5重复标识符

时间:2018-02-24 11:19:59

标签: node.js angular font-awesome font-awesome-5

如何在我的角项目中加载常规版和纯版faCircle(例如)?

如果我在app.component.ts中声明以下内容:

import faCircle from '@fortawesome/fontawesome-pro-solid/faCircle';
import faCircle from '@fortawesome/fontawesome-pro-regular/faCircle';

fontawesome.library.add(faCircle);
fontawesome.library.add(faCircle);

在构建过程中我将面临以下错误:

  

src / app / app.component.ts(22,9)中的错误:错误TS2300:重复   标识符'faCircle'。 src / app / app.component.ts(24,51):错误TS2300:   重复标识符'faCircle'。

1 个答案:

答案 0 :(得分:0)

愚蠢的打字稿问题......无论如何,这是我几分钟后发现的解决方案

import {faCircle as faCircleSolid} from '@fortawesome/fontawesome-pro-solid';
import {faCircle as faCircleRegular} from '@fortawesome/fontawesome-pro-regular';

fontawesome.library.add(faCircleSolid);
fontawesome.library.add(faCircleRegular);