Font-Awesome
Font-Awesome copied to clipboard
Feature request: ES export
Is your feature request related to a problem?
Using the @fortawesome/free-brands-svg-icons
pacakge in an Angular app:
FILE_NAME depends on '@fortawesome/free-brands-svg-icons/ICON_NAME'. CommonJS or AMD dependencies can cause optimization bailouts.
Feature description
The package not to use CommonJS exports
Alternatives
No response
Additional context
No response
Feature request checklist
- [X] The title starts with "Feature request: " and is followed by the requested feature description
- [X] This is a single feature
- [X] I have searched for existing issues and to the best of my knowledge this is not a duplicate
FA claims to be fully built using ES modules. I get this same build warning when using Angular as well.
From my digging, it seems the Angular build process uses static analysis to look for the require()
statement. If found it throws this warning. Lot's of icons have this require() call. But not all of them.
Oddly enough, Angular points to some icons in my project that don't use require()
. I don't know enough about the internals to have a solution though.
As a quick update, I've had some good luck with the shorted style:
import {faChevronUp} from '@fortawesome/free-solid-svg-icons';
vs the longer (supposedly the same)
import {faChevronUp} from '@fortawesome/free-solid-svg-icons/faChevronUp';
how about the final bundle size when using both variants above (short and long imports) ? Is it the same ?