You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When webpack configuration is used directly when CRA, it causes build-storybook to mangle function names. This causes issues that code source and prop types are not presented correctly.
As #3879 says, it could be solved by adding .displayName to each component, but since CRA is now removing prop types in production builds (facebook/create-react-app#3818), prop types are not visible in static version of storybook.
To Reproduce
Steps to reproduce the behavior:
Create app using Create React App
Install storybook
Create functional component and stories for it
Runnpm run build-storybook (without having custom webpack configuration)
Serve static storybook and see results.
Expected behavior
Function name is used as display name. Prop types are visible in page.
System:
Framework: React, react-scripts (2.1.1)
Addons: Info, knobs, options
Version: 4.0.2
Additional context
It might be that this is something that storybook can't really do anything else than suggest not using CRA's webpack configuration directly. However I would like to see if there is any suggestions how to solve this issue without using full control mode.
The text was updated successfully, but these errors were encountered:
jansav
changed the title
CRA's webpack configuration is mangling function names in static build
CRA's webpack configuration is mangling function names (and removing prop types) in static build
Nov 5, 2018
Describe the bug
When webpack configuration is used directly when CRA, it causes
build-storybook
to mangle function names. This causes issues that code source and prop types are not presented correctly.As #3879 says, it could be solved by adding
.displayName
to each component, but since CRA is now removing prop types in production builds (facebook/create-react-app#3818), prop types are not visible in static version of storybook.To Reproduce
Steps to reproduce the behavior:
npm run build-storybook
(without having custom webpack configuration)Expected behavior
Function name is used as display name. Prop types are visible in page.
System:
Additional context
It might be that this is something that storybook can't really do anything else than suggest not using CRA's webpack configuration directly. However I would like to see if there is any suggestions how to solve this issue without using full control mode.
The text was updated successfully, but these errors were encountered: