-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
strip proptypes in production build (fixes #1882) #2003
strip proptypes in production build (fixes #1882) #2003
Conversation
I guess we need to replace |
And what should happen to |
fb33957
to
a6b023a
Compare
Hi @jochenberger thank you for the PR, instead of putting the |
yes please 🙂 |
I'm not so sure. Don't we want to have the checks in the |
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 think that it's not safe to have if (process.env.NODE_ENV !== 'production')
anywhere other than in src
. We can't guarantee anything about the environment the code may be run in now or in the future, which doing so breaks.
I don't think there's any concern having proptypes in place in a node environment, if the consumer requires the lib
entry. React ignores proptypes in production anyway so this is only an optimisation for client-side package size.
Given the consistency of other major packages using babel-plugin-transform-react-remove-prop-types
I think that's the way to go, and let's not introduce environment specific code in our source that we don't need to (I'm happy to follow react-router's configuration for this in terms of which builds to apply the plugin to)
Please update to use |
a6b023a
to
5da115a
Compare
Done. Now the only file size change is |
Neat, thanks @jochenberger! |
File size changes:
See also #1876.