Search code examples
node.jsangularfont-awesomefont-awesome-5

Fontawesome 5 duplicate identifier


How do I load both regular and solid version of faCircle (for example) in my angular project?

If I declare in app.component.ts the following:

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

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

I gonna face the following error during the build process:

ERROR in src/app/app.component.ts(22,9): error TS2300: Duplicate identifier 'faCircle'. src/app/app.component.ts(24,51): error TS2300: Duplicate identifier 'faCircle'.


Solution

  • Dumb typescript question...anyway here's the solution I found a couple of minutes later

    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);