-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
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
[pigment-css] Fix propTypes removal during eval stage #41695
Conversation
Conditional assignment of propTypes was not handled resulting in error while using prod builds of material-ui.
Netlify deploy previewhttps://deploy-preview-41695--material-ui.netlify.app/ Bundle size report |
export function App() { | ||
return ( | ||
<Component> | ||
<SliderRail /> | ||
<SliderRail2 /> | ||
</Component> | ||
); | ||
} | ||
|
||
process.env.NODE_ENV !== 'production' | ||
? (App.propTypes = { | ||
children: PropTypes.element, | ||
}) | ||
: void 0; |
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.
What would happen if the propTypes are not handled? I guess the test will throw during evaluation?
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.
Correct.
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.
During evaluation, App gets set to null. So we are setting a value to null object resulting in the error.
App = null;
App.propTypes = {}
Conditional assignment of propTypes was not handled resulting in error while using prod builds of material-ui.