FortAwesome / Font-Awesome

The iconic SVG, font, and CSS toolkit
https://fontawesome.com
Other
73.7k stars 12.19k forks source link

Bug: Next.js Styles Not Loading #19767

Open jared-leddy opened 1 year ago

jared-leddy commented 1 year ago

Bug description

Solution: Large Font Awesome Icon Issues on Next.js

From the problem above, we had large icons and many icons were missing. We added the code below, and our icon problem went away.

import { config } from '@fortawesome/fontawesome-svg-core'
import '@fortawesome/fontawesome-svg-core/styles.css'
config.autoAddCss = false

Once the icon problem went away, we discovered that our custom SCSS files were not loading. For Next.js, the issue does not happen in dev on localhost. Only when using prod, or the app is deployed on Vercel, does this problem show up.

Min-Reproduction

NPM Versions

{
    "@fortawesome/free-brands-svg-icons": "^6.4.0",
    "@fortawesome/free-solid-svg-icons": "^6.4.0",
    "@fortawesome/react-fontawesome": "^0.2.0",
}

Reproducible test case

https://github.com/carbondigitalus/min-repro

Screenshots

No response

Font Awesome version

v6.4.0

Serving

Other (as specified in the bug description)

Implementation

Other (as specified in the bug description)

Browser and Operating System

Web bug report checklist

jared-leddy commented 1 year ago

Still trying to resolve this issue.

alexander-rebello commented 7 months ago

I have the same issue. At least the temporary solution works great!