-
Notifications
You must be signed in to change notification settings - Fork 49.7k
Resolve the .default export of a React.lazy as the canonical value #34906
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
Conversation
|
Comparing: 40c7a7f...a12cc9a Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: Expand to show
|
c159918 to
29e1169
Compare
7e46974 to
9ed4f33
Compare
| // Surface the default export as the resolved "value" for debug purposes. | ||
| const debugValue = | ||
| moduleObject == null ? undefined : moduleObject.default; | ||
| resolveDebugValue(debugValue); | ||
| // $FlowFixMe | ||
| ioInfo.value.status = 'fulfilled'; | ||
| // $FlowFixMe | ||
| ioInfo.value.value = debugValue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block isn't gated on enableAsyncDebugInfo but resolveDebugValue is only callable with enableAsyncDebugInfo. enableAsyncDebugInfo isn't enabled everywhere at the moment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this is implied via payload._ioInfo but still nice for DCE and readability to gate it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed. The whole block should've been gated before just like the reject.
9ed4f33 to
a12cc9a
Compare
) Stacked on #34906. Infer name from stack if it's the generic "lazy" name. It might be wrapped in an abstraction. E.g. `next/dynamic`. Also use the function name as a description of a resolved function value. <img width="310" height="166" alt="Screenshot 2025-10-18 at 10 42 05 AM" src="https://github.com/user-attachments/assets/c63170b9-2b19-4f30-be7a-6429bb3ef3d9" />
[diff facebook/react@1324e1bb...58bdc0bb](facebook/react@1324e1b...58bdc0b) <details> <summary>React upstream changes</summary> - facebook/react#34911 - facebook/react#34907 - facebook/react#34906 - facebook/react#34898 - facebook/react#34893 - facebook/react#34892 - facebook/react#34885 - facebook/react#34881 - facebook/react#34894 - facebook/react#34880 - facebook/react#34849 - facebook/react#34900 - facebook/react#34887 </details>
For debug purposes this is the value that the
React.lazyresolves to. It also lets us look at that value for descriptions like its name.