npm i -D @louislombardo/babel-plugin-fix-font-awesome
In your babel config:
module.exports = {
presets: ["module:metro-react-native-babel-preset"],
plugins: ["@louislombardo/babel-plugin-fix-font-awesome"],
}
This is a Babel plugin aimed at transforming imports from Font Awesome to reduce React Native bundle sizes
This:
import { faBadgeCheck } from '@fortawesome/pro-solid-svg-icons';
import { faCheck, faCalendar as proCalendarIcon } from '@fortawesome/pro-regular-svg-icons';
Becomes this:
import { faBadgeCheck } from '@fortawesome/pro-solid-svg-icons/faBadgeCheck';
import { faCheck } from '@fortawesome/pro-regular-svg-icons/faCheck';
import { faCalendar as proCalendarIcon } from '@fortawesome/pro-regular-svg-icons/faCalendar';