When you import anything from @fortawesome/fontawesome-svg-core it comes with all batteries included.
But with a few small changes you can pick the plugins you wish to use. This saves bytes and can improve performance if you aren't wasting time doing unnecessary things.
An Example
Advertisement
Remove ads with a Pro plan!
A subscription to a Pro-level plan will remove all third-party advertisements on fontawesome.com.
And of course Pro-level plans come with…
All 26,233 icons in Font Awesome
5 Classic styles of every icon
3 Sharp styles of every icon
A Perpetual License to use Pro
Services and tools to make easy work of using icons
An important point to make here is that the api object is now created by calling register() from the @fortawesome/fontawesome-svg-core/plugins module. Calls
to things like library.add() will need to become api.library.add(). If you are importing anything from @fortawesome/fontawesome-svg-core (without plugins)
you'll lose the benefits of the plugin system altogether.
Compare the file-sizes before and after using the plugin system.
The following sizes were measured using a code minifier called Terser
Terser is already included in this example because you installed it earlier.
Run NODE_ENV=production npx rollup -c rollup.config.js to use it.
Filename
Size
dist/fontawesome.js
61k
dist/fontawesome-lite.js
45k
Well, butter my bread! That's 16k saved. Using "lite" may be a bit generous, but
we'll be continuing to improve this API as time goes on. This architecture also
promises to open up some new possibilities with Font Awesome in the future.