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

How to disable mangled component names during build-storybook #363

Closed
stipsan opened this issue Aug 7, 2016 · 3 comments
Closed

How to disable mangled component names during build-storybook #363

stipsan opened this issue Aug 7, 2016 · 3 comments

Comments

@stipsan
Copy link

stipsan commented Aug 7, 2016

Hey,

When you build a static storybook the component names get mangled, as seen here: http://uikit-react.io/

This is suboptimal when using the React Storybook Info Addon
I've tried to use the "full-control" mode but without luck.

Here's the webpack config for the storybook: https://github.com/stipsan/uikit-react/blob/master/.storybook/webpack.config.js

@thani-sh
Copy link
Contributor

thani-sh commented Aug 7, 2016

It's happening because component names are getting minified. It's done by the uglifyjs plugin here. You can remove that plugin with the "ful-control" mode to fix the issue. A better solution is to set the displayName property for your React Components so it'll work with the info addon and React Devtools.

@arunoda
Copy link
Member

arunoda commented Aug 8, 2016

I think thanish has the answer. Check the storybook-addon repo's issues for more info on this.

@arunoda arunoda closed this as completed Aug 8, 2016
@stipsan
Copy link
Author

stipsan commented Aug 24, 2016

Hey guys,

While the displayName solution works in most cases, it appears it does not work for components passed as props.

Example: https://form.uikit-react.io/?selectedKind=renderInput&selectedStory=Basic%20Usage&full=0&down=1&left=1&panelRight=0

Here it should be:

<Field
    component={renderField}

But instead it's:

<Field
    component={c()}

Despite giving it displayName here.

Is it possible to override the mangle without having to use full-control mode? With Webpack 2 closing in, having to do full-control mode will likely have to be redone then.

Thanks

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

3 participants