question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing styles in production (NextJS + Chakra)

See original GitHub issue

Current behavior:

Styles present in development: Screenshot 2021-04-10 at 15 41 37

Are missing in production: Screenshot 2021-04-10 at 15 41 47

To reproduce:

ezgif-6-632406f2e83a

The only difference between the menus are depending on the auth state: showing or not additionnal button actions. I suspect something is breaking the style in the Menu component. But I tried a lot of things, I don’t understand what’s the issue…

https://github.com/binajmen/chakra-nextjs/blob/develop/components/layout/Menu.tsx

Note that in development (yarn dev), I have no styling issue.

Expected behavior:

Environment information:

"dependencies": {
  "@chakra-ui/react": "^1.3.3",
  "@emotion/react": "^11.1.5",
  "@emotion/styled": "^11.1.5",
  "emotion-theming": "^11.0.0",
  "next": "^10.0.7",
  "react": "17.0.1",
  "react-dom": "17.0.1",
  ...
},

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

7reactions
ivancuriccommented, Aug 17, 2021

Fixed by putting the following in my package.json:

  "resolutions": {
    "react-select/@emotion/react": "^11.4.1"
  }
2reactions
Andaristcommented, Oct 13, 2021

Execute this script asap in your app:

var value
Object.defineProperty(window, '__EMOTION_REACT_11__', {
  set(newValue) {
    value = newValue
    debugger
  },
  get() {
    return value
  }
})

and inspect the call stack for both calls to this setter

Read more comments on GitHub >

github_iconTop Results From Across the Web

Page refresh break styles on Nextjs production app
The Styled-Components documentation mentions this very briefly and it is easy to miss. What we actually have to do is inject server-side ...
Read more >
Blog - Next.js 13
Next.js 13 introduces layouts, React Server Components, and streaming in the app directory, as well as Turbopack, an improved image ...
Read more >
Blitz.js - The Missing Fullstack Toolkit for Next.js
Blitz picks up where Next.js leaves off, providing battle-tested libraries and ... For example, we don't mandate which styling or form libraries you...
Read more >
Upgrading to v1 - Chakra UI
To allow for better checkbox group layout, the CheckboxGroup component no longer supports every style prop. You can now only pass size ,...
Read more >
How I built my portfolio using NextJS, Typescript, and Chakra UI
NextJS is one of the strongest frameworks to build a production project. ... Here's the styling part, I use chakra-ui for creating reactjs...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found