babel-plugin-react-docgen icon indicating copy to clipboard operation
babel-plugin-react-docgen copied to clipboard

Does not work in my case if I use the babel configuration in webpack

Open s-kobets opened this issue 7 years ago • 2 comments

Use webpack.config

use: {
          loader: 'babel-loader',
          options: {
            presets: ['env', 'react'],
            plugins: [
              'transform-class-properties',
              'react-docgen'
            ]
          }
        }
class Doc extends PureComponent {
  static defaultProps = {
    name: 'stranger'
  };

  static propTypes = {
    name: PropTypes.string
  };
  render() {
    return <div>123</div>;
  }
}

return Doc.__docgenInfo = undefined

s-kobets avatar Jun 24 '18 15:06 s-kobets

I am sorry, win. If import Doc in file index.js then working if use console.log(Doc.__docgenInfo) in file when create class Doc - not work

s-kobets avatar Jun 24 '18 15:06 s-kobets

I wonder if docgen detects PureComponent as a valid class type. Let me investigate this when I have time, or please feel free to open a PR if you'd like to try and solve this as well.

danielduan avatar Jul 23 '18 22:07 danielduan