-
-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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
chore: handle next.js build issue #48829
Conversation
Run & review this pull request in StackBlitz Codeflow. |
👁 Visual Regression Report for PR #48829 Passed ✅
🎊 Congrats! No visual-regression diff found. |
size-limit report 📦
|
Great job! @zombieJ |
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #48829 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 746 746
Lines 12996 13009 +13
Branches 3412 3419 +7
=========================================
+ Hits 12996 13009 +13 ☔ View full report in Codecov by Sentry. |
中文版模板 / Chinese template
🤔 This is a ...
🔗 Related issue link
close #48758
Reported this to Next.js repo: vercel/next.js#65512
💡 Background and solution
I do believe it's not
antd
bug. But a strange mix bug withNext.js
&babel
&Webpack
.Dig the build process of
next build
found the first compile of webpack is work as expected. But theGenerating static page
step will hang for a long time.After debug the break point or dump the memory heap, there is nothing special about this. Break point is normal for the parsing and memory heap is stable (for antd with nextjs example, it's stable between ~80MB). It takes me lots of time, sad 😅.
Since
5.16.5
works well, it can use theresolution
ofpackage.json
to check all the diff dependencies version. And finally found that lockrc-field-form
to v1 version will back of the speed.After that, check what changed in
rc-field-form
v2.0.0, and found the depsasync-validator
replaced with@rc-component/async-validator
. What change is usingfather@4
& correct the type definition.Modify the
node_modules/@rc-component/async-validator
code to check what happened:The build speed back again. But when back of the
import
, it becomes slow again:I guess it must have some dependencies cycle in it but finally get none. All the files dependencies is clear. So it have to comment code in it to check what make it slow. Skip the checking process, it comes from the follow code:
Source code:
The compiled code in
async-validator
package:The difference is the string concat replaced by babel with
.concat
function. When replace the code with the original one, Next.js fast again.I'm not sure why the long
.concat
makes Next.js slow. But for antd side, we can do the workaround:Fixed with magic code. But Next.js may need help to check on this.
📝 Changelog
Next.js
build bad perf issue.Next.js
编译性能问题。☑️ Self-Check before Merge