-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Description
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
- Run
npm 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.