Missing styles in production (NextJS + Chakra)
See original GitHub issueCurrent behavior:
Styles present in development:
Are missing in production:
To reproduce:
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:
- Created 2 years ago
- Comments:15 (6 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Fixed by putting the following in my
package.json
:Execute this script asap in your app:
and inspect the call stack for both calls to this setter