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
I added code panel to the storybook using this. My Storybook with Vite renders code snippets correctly locally, but in the deployed production build, component names ('abcdef' and 'xcvgdfey') are replaced with minified versions ('z' and 'v').
** Disclaimer** This information might be inaccurate, due to it being generated automatically
This is caused by Vite's production build minification. To preserve component names in the code panel, add the following to your vite.config.js: js export default { build: { minify: true, terserOptions: { mangle: { keep_classnames: true, keep_fnames: true }, compress: { keep_classnames: true, keep_fnames: true } } } } For Storybook specifically, you can also configure this in .storybook/main.js: js export default { framework: '@storybook/react-vite', viteFinal: (config) => { config.build = config.build || {}; config.build.terserOptions = { mangle: { keep_classnames: true, keep_fnames: true }, compress: { keep_classnames: true, keep_fnames: true } }; return config; } };
About Greptile
This response provides a starting point for your research, not a precise solution.
Help us improve! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.
Describe the bug
I added code panel to the storybook using this. My Storybook with Vite renders code snippets correctly locally, but in the deployed production build, component names ('abcdef' and 'xcvgdfey') are replaced with minified versions ('z' and 'v').
Why it is happening? and how to fix this?
Reproduction link
SchwarzIT/onyx#2379
Reproduction steps
No response
System
Additional context
No response
The text was updated successfully, but these errors were encountered: