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

prop-types should be removed from production builds published to npm #208

Open
dballance opened this issue Jun 11, 2020 · 3 comments
Open
Assignees

Comments

@dballance
Copy link

prop-types appearing in production builds makes downstream consumption with rollup or another bundler more complex than it should be.

As it stand today, I have to ship prop-types with my bundle or utilize babel + plugin to shake out prop-types.

@JorgenEvens JorgenEvens self-assigned this Jun 15, 2020
@JorgenEvens
Copy link
Member

Hi @dballance,

Would wrapping them in a NODE_ENV == 'production' check fix your issues with rollup? I'd prefer to have propTypes available during development.

More info on this suggestions: [1] and [2]

@dballance
Copy link
Author

I think so!

Basically, I'm down for whatever way you want to handle it. Having them in dev is great and I think you should absolutely have that option if you want. I don't think there is an expectation that they disappear entirely.

As long as prop-types isn't a peer dep or directly referenced in a production bundle (via NODE_ENV or Babel plugin or similar) it would be much better from a consumption standpoint.

Thanks!!

@ruckc
Copy link

ruckc commented Sep 16, 2022

bump.... running into this today through react-avatar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants