Error with Sage 9 and FontAwesome

Hi everyone,

I am trying to add font awesome icons to Sage 9, and it shows on the page, but there is an error on the console log that I don’t understand how it happens.

image

image

I put the fontawesome inside the main.js file

import fontawesome from "@fortawesome/fontawesome";
import * as addressBook from '@fortawesome/free-solid-svg-icons/faAddressBook';

fontawesome.library.add(addressBook);

My package.json

  "dependencies": {
    "@fortawesome/fontawesome": "^1.1.8",
    "@fortawesome/fontawesome-free-brands": "^5.0.13",
    "@fortawesome/free-solid-svg-icons": "^5.1.1",
    ....
  }

It works but there still an error. Can you help to demystify this? Thanks,

Hey @dalenguyen - In case you haven’t figured this out yet, I recently updated this guide to reflect Font Awesome 5.1. You may be able to learn something from comparing the setup there to how you set it up.

Edit: took a closer look at your package.json and I see you’re using the older, deprecated packages for @fortawesome/fontawesome and @fortawesome/fontawesome-free-brands but the new package for @fortawesome/free-solid-svg-icons. The latter needs to be used with the new @fortawesome/fontawesome-svg-core package rather than the older packages you’re using (see the guide I linked to).

1 Like

Thanks @mmirus, it does work based on your method!!!

1 Like