babel-plugin-styled-require
v1.0.0
Published
Babel plugin that adds Styled from styled components import declaration if file contains JSX tags.
Downloads
2
Readme
babel-plugin-proptypes-require
Babel plugin that adds PropTypes import declaration if file contains JSX tags.
Example
Your component.js
that contains this code:
export default function Component() {
return <div />;
}
will be transpiled into something like this:
import PropTypes from 'prop-types';
export default function Component() {
/* this part will be transpiled by babel itself as usual */
return React.createElement('div');
}
Usage
- Install
babel-plugin-proptypes-require
.
npm install babel-plugin-proptypes-require --save-dev
- Add
proptypes-require
into.babelrc
. This plugin should be defined beforetransform-es2015-modules-commonjs
plugin because it's using ES2015 modules syntax to importReact
into scope.
{
"plugins": ["proptypes-require"]
}