Skip to content

FOUC: Warning: Text content did not match. Server: "...css..." #3108

@lancejpollard

Description

@lancejpollard

Getting large error (printing all of CSS used in <style jsx global>) in web console.

Warning: Text content did not match. Server: "
...(css)...

I think this is causing FOUC, so there is a flash of unstyled content followed by a second later the actual styles.

This is coming from a library being used in a next project (from #3088).

  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

  • Styles should be applied from server directly.
  • There should be no FOUC
  • There should be no error in web console

Current Behavior

To elaborate a little more, when rendering a next app in the library itself (so some page in that repo), the styles render fine. View-source shows source maps and minified CSS in the HTML markup.

However, when using that same code as a compiled project loaded into a separate next app, the markup in view-source shows unminified CSS and no source maps (and we get the web console error and fouc).

Steps to Reproduce (for bugs)

  1. See ModuleParseError when referencing external repo #3088 for setup.
  2. I am manually compiling some files in repo-b using babel <folder> --out-dir ... etc., and then importing that and also importing babel-polyfill if that matters.

Context

This is just unexpected behavior making the app not look right (ux).

Your Environment

Tech Version
next 4beta2
node 8.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions