Dynamic Theme breakes on SSR
See original GitHub issue- I have searched the issues of this repository and believe that this is not a duplicate.
Steps to reproduce
npx create-next-app@latest --ts
npm i antd
Then change _app.tsx
and add
import { ConfigProvider } from 'antd'
ConfigProvider.config({
theme: {
primaryColor: '#f00'
}
})
What is expected?
Build successfull
What is actually happening?
Build fails with:
ReferenceError: document is not defined
at getContainer (./node_modules/rc-util/lib/Dom/dynamicCSS.js:32:14)
at updateCSS (./node_modules/rc-util/lib/Dom/dynamicCSS.js:90:19)
at registerTheme (./node_modules/antd/lib/config-provider/cssVariables.js:96:29)
at Function.setGlobalConfig [as config] (./node_modules/antd/lib/config-provider/index.js:87:37)
at eval (webpack-internal:///./pages/_app.tsx:14:50)
at Object../pages/_app.tsx (./.next/server/pages/_app.js:22:1)
at __webpack_require__ (./.next/server/webpack-runtime.js:33:42)
at __webpack_exec__ (./.next/server/pages/_app.js:64:39)
at ./.next/server/pages/_app.js:65:28
at Object.<anonymous> (./.next/server/pages/_app.js:68:3)
Environment | Info |
---|---|
antd | 4.18.7 |
React | 17 |
System | Mac OS |
Browser | - |
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Add a page break to a paginated report (Report Builder)
To add a page break to a data region · On the design surface, right-click the corner handle of the data region and...
Read more >Page refresh break styles on Nextjs production app
This way you will force it to create styles only after the client-side is loaded. Guide to disable SSR for a component: https://nextjs.org/docs/ ......
Read more >SSR Related Links - Chevy SSR Club
Web links for repair, parts, accessories, etc…. Aftermarket and OEM Accessories and Parts – Simple Engineering – Source for parts and accessories.
Read more >1PZ SSR-SD2 Brake Pads Replacement for SDG SSR 50cc ...
Buy 1PZ SSR-SD2 Brake Pads Replacement for SDG SSR 50cc 70cc 110cc 125cc 140cc Thumpstar Coolster Orion Demon Stomp BSE Kayo Lifan YX...
Read more >2006 Chevy SSR: A seriously sporty ride - The Virginian-Pilot
It's the 2006 Chevrolet SSR sport pickup, created by General ... disc brakes with four-wheel antilock system and dynamic rear proportioning.
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
but this is not the optimal way, maybe you can expose a funtion that generates the required CSS Styles. So we can run this at SSR and inject the styles ourself?
something that we can get this on SSR:
so we can pass them as props and inject it via:
I love this way, can you please share the code to do that ?