FortAwesome / react-fontawesome

Font Awesome React component
https://fontawesome.com
MIT License
3.67k stars 262 forks source link

Two react apps, only one can import fonts #561

Closed frkboak closed 2 months ago

frkboak commented 3 months ago

Describe the bug We have two react apps running on the same page, each of which is importing FontAwesomeIcon from @fortawsome/react-fontawesome and fonts from @fortawesome/pro-regular-svg-icons.

When just one of the react apps is running on a page, icons display just fine.

When both react apps are running on the same page, only one is able to display icons. In the other one, we get undefined for any icons we import from @fortawesome/pro-regular-svg-icons

(we tested importing free icons and they have the same problem)

Reproducible test case Can't really share sample code, sorry.

Expected behavior A clear and concise description of what you expected to happen.

Desktop (please complete the following information):

Windows 10

(also Chrome 124.0.6367.156 and Firefox 125.0.3)

Additional context Add any other context about the problem here.

sachinrepaswal commented 3 months ago

Try isolating the imports of @fortawesome/react-fontawesome and @fortawesome/pro-regular-svg-icons within each React app. This means that each app should have its own instance of these imports, rather than sharing them globally.

frkboak commented 3 months ago

thanks. sounds like I probably need to teach myself webpack, which is what we're using to build these apps

robmadole commented 2 months ago

I can re-open this if there turns out to be a problem with this library.