You're viewing docs for v5.15.4, an older version of Font Awesome.

Something not working with the Javascript API? Here are some common snags and how to get yourself out of trouble.

Tree-shaking isn't working or performing slowly

More detailed information about tree-shaking can be found here.

For most bundler tools tree-shaking only works well if you are using an ES module. The Font Awesome API and all the components we provide are available in ES modules. If you have problems configuring your tool it probably means that Webpack or Rollup is not using ES modules from the node_modules directory. This can be a bit of of black hole to fix and we recommend you go with the simpler import method. We're not trying to tell you what to do we just hate to watch you beat yourself in the face with a hammer.

These two import methods are identical:

import { faUser } from '@fortawesome/free-solid-svg-icons'
import { faUser } from '@fortawesome/free-solid-svg-icons/faUser'

The benefit of using @fortawesome/free-solid-svg-icons/faUser is that it bypasses tree-shaking altogether and simply imports a submodule.

What if I need help with something else?

You can always check our support docs or ask our community (opens new window) if anyone has experience with or guidance for your situation. If you think you've spotted a bug, we'd love to know. If you want or need a feature we don't have yet, we want to know that too - let us know!