Next.js: FOUC using both global CSS and CSS modules

Created on 19 Mar 2020  路  5Comments  路  Source: vercel/next.js

Bug report

Describe the bug

When I use both global CSS and CSS modules and I import some JS libraries, there is a flash of unstyled content when I view the page in the dev mode.

The FOUC disappears when I don't import the CSS module file OR when I don't import any JS libraries...

It is only happening in the dev mode which makes it not a huge concern but it is still a bit stressful 馃槃

To Reproduce

Complete reproduction on https://github.com/tomdohnal/nextjs-fouc

  1. Go to http://localhost:3333
  2. You can see the FOUC

You have to either do a hard refresh or open the page in a tab to experience the FOUC.

Expected behavior

There should be no FOUC.

System information

  • OS: macOS, Linux (not tested on Windows)
  • Browser: Chrome, Firefox (not tested on other ones)
  • Version of Next.js: 9.3.1
bug needs investigation

Most helpful comment

This should be fixed in next@^9.4.5-canary.15! Please upgrade and let us know.

All 5 comments

Probably related to #12448 and #10268

Never heard of the Acronym "FOUC" before :)

This should be fixed in next@^9.4.5-canary.15! Please upgrade and let us know.

Works like charm!

Was this page helpful?
0 / 5 - 0 ratings