facebook / prop-types

Runtime type checking for React props and similar objects
MIT License
4.48k stars 356 forks source link

How to use it with webpack aliases? #292

Closed ghost closed 5 years ago

ghost commented 5 years ago

I'm using webpack aliases: alias: { _components_: path.resolve(__dirname, 'src/components') }

and import components as import { TodoList } from '_components_/TodoList';

With this type of import I don't get the prop types of the imported component. And the component props doesn't shows too.

How to use the prop-types with aliases?

ljharb commented 5 years ago

Webpack aliases shouldn’t be able to have any impact on that, and this library has nothing to do with it.

If the component has propTypes attached, they’ll show up with the component. If not, it’s a webpack issue.