babel-plugin-react-docgen
babel-plugin-react-docgen copied to clipboard
Does not work in my case if I use the babel configuration in webpack
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
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
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.