-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
[Bug]: show code
not displaying component names in prod build
#28427
Comments
To resolve the issue with
import { type StorybookConfig } from '@storybook/react-vite';
import { mergeConfig } from 'vite';
const config = {
// ... other configurations
async viteFinal(config) {
return mergeConfig(config, {
optimizeDeps: {
include: ['storybook-dark-mode', '@adaptavant/*'],
},
resolve: {
alias: {
'next/router': 'next-router-mock',
},
},
build: {
rollupOptions: {
output: {
manualChunks: {
react: ['react'],
},
},
},
sourcemap: true, // Ensure sourcemaps are enabled
},
});
},
} satisfies StorybookConfig;
export default config;
const MyComponent = React.forwardRef((props, ref) => {
// component implementation
});
MyComponent.displayName = 'MyComponent'; These steps should help in resolving the issue with component names in the production build. References/code/.storybook/main.ts
|
Component Display Names actually works ! the vite config didnt help ... but is there any other way we can address this ? because this includes adding displayName for all components |
@nandhiniG this is the same issue as #20920, and that has been fixed recently. Please upgrade to the latest 8.x! |
Describe the bug
Show code
displays transformed component names and[object Object]
for forwarded ref components in prod build.In Dev Mode :
In prod build:
main.ts
Reproduction link
https://earth.anywhere.co/storybook/index.html?path=/docs/components-button--docs
Reproduction steps
1)Use storybook react + vite project
2) Add component examples
3) Run in dev mode we can see the component code is as expected in the show code.
4)Run in prod mode, using a HTTP server the component names are messed up
System
Additional context
We identified partial issue is reported and see a fix released in 8.0.2 , we tried the same but the issue still persists #26566
The text was updated successfully, but these errors were encountered: