oliviertassinari / babel-plugin-transform-react-remove-prop-types

Remove unnecessary React propTypes from the production build. :balloon:
MIT License
897 stars 61 forks source link

Doesn't work with react-navigation library #188

Open serhiipalash opened 5 years ago

serhiipalash commented 5 years ago

Hi @oliviertassinari ! Thank you for such a great plugin! It makes our app much more performant in production.

Unfortunately, it doesn't work with latest version of react-navigation library or maybe library doesn't work with your plugin. I am not sure on what side the issue is.

Once you add babel-plugin-transform-react-remove-prop-types plugin in the project, which uses react-navigation code, the build fails with error TypeError: undefined is not an object (evaluating '_getPrototypeOf2.default').

Simulator Screen Shot - iPhone 6s - 2019-08-24 at 00 30 30

But react-navigation doesn't have any prop-types in its code and the real problem is that their source code is already compiled with Babel to something like this

Screen Shot 2019-08-23 at 9 26 08 PM

They use bob package for building their sources https://github.com/react-native-community/bob

Adding react-navigation to ignoreFilenames config option doesn't help.

react-navigation is a very popular library and it is often used with Expo framework. Can you investigate what is wrong and where?

Here is the test repo where you can test the bug https://github.com/serhiipalash/test-transform-react-remove-prop-types/commits/master . If you don't have phone simulator installed on your pc, you can do

npm install -g expo-cli
expo start --tunnel

and open the project on your real device by screenshoting QR-code, displayed in Terminal, with Expo mobile app