Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default Webpack configuration seems to minify everything by default and doesn't catch prop types #379

Closed
FarhadG opened this issue Aug 14, 2016 · 2 comments

Comments

@FarhadG
Copy link

FarhadG commented Aug 14, 2016

By the way, I must say that I absolutely love this project. It's been very easy getting up-and-running. A few things I've noticed:

  • Default Webpack build minifies everything or the component names are preserved, which makes it difficult for the documentation aspect (using addWithInfo).
  • Either due to the minification or the fact that propTypes cannot be read when exported components are wrapped in higher order functions, I cannot get the propTables to pick up the propTypes

Here's a quick example:

Story Source
<e progress={10} radius={120} strokeWidth={10} />
Prop Types
"" ComponentNo propTypes defined!
"e" ComponentNo propTypes defined!

As you can see above, the component has been renamed to e (assuming it's just minified) and no propTypes are found when I enable them with { propTables: [SampleComponent] } when using addWithInfo. SampleComponent is wrapped with two higher order functions and then exported.

Thanks for your insights...

@arunoda
Copy link
Member

arunoda commented Aug 14, 2016

Try to define a displayName for your component. It'll fix this.
Minification is something we must do.

Check this: storybook-eol/react-storybook-addon-info#43

@arunoda arunoda closed this as completed Aug 14, 2016
@arunoda
Copy link
Member

arunoda commented Aug 14, 2016

If this is something else, try to create an issue on the addon-info repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants