Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ant cssinjs causes the NextJS app broken in production mode #44433

Closed
camcam2605 opened this issue Aug 25, 2023 · 1 comment · Fixed by ant-design/ant-design-examples#27
Closed
Labels
🐛 Bug Ant Design Team had proved that this is a bug. Next.JS

Comments

@camcam2605
Copy link

camcam2605 commented Aug 25, 2023

Reproduction link

https://github.com/ant-design/ant-design-examples/tree/main/examples/with-nextjs-app-router-inline-style

Steps to reproduce

  1. Clone repo from the official examples: https://github.com/ant-design/ant-design-examples/tree/main/examples/with-nextjs-app-router-inline-style.
  2. Run npm i to install dependencies.
  3. Add Link component redirect to home page in root page.tsx (app/page.tsx):
  import Link from 'next/link';
  
  <Link href="/">Go Home</Link>
  1. Run npm run build and npm run start.
  2. Go to localhost:3000
  3. Press to the link "Go Home"

What is expected?

NextJS app should not broken

What is actually happening?

NextJS app broken and throw the error in console: TypeError: Cannot read properties of null (reading '1')

See:
image

Environment Info
antd 5.8.4
React React 18
System Windows
Browser Chrome

I checked and ensuring that the cause comes from the cssinjs package because when I trying to remove the StyleProvider component and re-build then the nextjs app works fine and vice versa.
It is similar to this issue but occurs in production mode: #43510 (comment)

@zombieJ
Copy link
Member

zombieJ commented Aug 26, 2023

@camcam2605 updated. pls check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 Bug Ant Design Team had proved that this is a bug. Next.JS
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants