-
Notifications
You must be signed in to change notification settings - Fork 61
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
propTypes from stateless functional components not being removed #140
Comments
@nijk Thanks for the reproduction. It sounds like a bug. |
Typescript output is also not processed. It contains propTypes inside of class iife but this plugins handles only top level propTypes assignments. |
I'm experiencing same thing. At first I thought the plugin was not removing any propTypes but after reading this issue and looking into the build I noticed it was only the functional component's propTypes not being removed i.e. plugin removed propTypes from class components only. |
I'm closing, the react popper issue is too high level. It doesn't mean it's an issue with this Babel plugin. Library authors should use the wrap mode. They should have the prop types in the modules they publish to npm. For a UMD release, this depends on the dev vs prod target. |
@oliviertassinari Thanks, I've spent a few minutes generating a minimal reproduction of the issue here. I may well be doing something wrong but here's what I found:
|
We should fix that: https://github.com/nijk/babel-plugin-transform-react-remove-prop-types-issue-140.
This is a no problem: https://unpkg.com/react. |
@oliviertassinari is that not the development version of React? The production version doesn't attempt to access |
Sorry, ignore that - I've just re-read the file you linked to |
Anything I can do to help push this along? I can't tell if this is a fix or not... |
I'm aware that issues have been raised for this previously and work done to fix it.
However I'm seeing issues with a library (ReactPopper) that uses this plugin. The library currently uses this plugin but with
{ mode: 'wrap' }
which results in minified builds that referenceprocess.env
- which is not something we want, react-popper GH Issue here. I've forked the library and made the config change tobabel-plugin-transform-react-remove-prop-types
here but I'm seeing thatpropTypes
still exist on the stateless functional components:Steps to reproduce
git clone https://github.com/nijk/react-popper.git
git checkout v0.x
cd react-popper
npm install
grep propType dist/react-popper.min.js
propTypes
exists in thegrep
output, namely on theTarget
&Arrow
components - both of which are stateless functional components.The text was updated successfully, but these errors were encountered: