babel-plugin-flow-react-proptypes: PropTypes is not defined

Hi, I recently updated from 2.2.1 up to 17.1.2, and I’ve started getting errors like:

Uncaught ReferenceError: PropTypes is not defined

It seems that the plugin is not adding the import of PropTypes correctly, maybe? Or is there something else I’m missing? I’m on react 15.4.2, in case that matters.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (10 by maintainers)

Most upvoted comments

That config option should probably be renamed to ‘forceESModules’ but the behavior is correct. The 'deadCode' option switches it to use require, and useESModules overrides that.

The useESModules option forces this plugin to output ES6 module […]

The import is added by this plugin, but maybe babel is detecting a duplicate import and removing the one we add from the final code? I don’t think this plugin is doing that check, but I’m not sure.