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]: @storybook/addon-controls break some stories #27071
Comments
UPDATE: I've looked into the barrel imports (using index.js to re-export modules), and it seems to be causing issues when It's just super weird, cause everything works fine when |
Also - using TypeScript, Webpack 5 and Babel here + the storybook nextjs framework |
I've narrowed it down to be happening for the following scenario:
import React from 'react';
import TestComponent from '@/src/components/TestComponent'; // imports from barrel file (index.tsx)
export default {
component: TestComponent,
};
export const CoolStory = (args) => <TestComponent {...args} />;
CoolStory.args = {
text: 'Hello',
}; And the import AnotherModule from "../AnotherModule"; // this is not utilized or explicitly imported, but I think react-docgen analyzes it which causes the undefined module error???
import TestComponent from './TestComponent';
export { AnotherModule };
export default TestComponent; |
I haven't heard of this issue before. One thing you can try is to turn off docgen in // .storybook/main.js
export default {
typescript: { reactDocgen: false }
} This means that you will not get autogenerated controls, but if you still want docs/controls it could be a workaround. If you can create a reproduction at https://storybook.new or see repro docs it might be possible for somebody from the team to debug what's going on. |
Describe the bug
Working on a Storybook application for a large corporation and we are trying to upgrade from Storybook v6 to v7. I have already gotten rid of the old addon-knobs library in favor of @storybook/addon-controls before the migration. The issue I'm seeing is with one specific story file and I can't for the life of me figure out what's going on. The story works perfect when I don't add @storybook/addon-controls inside of the addons array in main.js. As soon as adding it, I see some error about
Modal is undefined
, Modal being a component that is not even imported in my Story. I've noticed that for some broken stories I can fix them by converting certain barrel imports (using index.js files for re-exporting modules) into importing from each separate module.I'm stumped at this point. I've tried downgrading to earlier minor versions of Storybook, switched to @storybook/addon-essentials - I just don't get what the issue could be.
Here's storybook/main.js:
To Reproduce
I can't share the repo since it's for my work - But hoping this is a common issue with @storybook/addon-controls
System
Additional context
No response
The text was updated successfully, but these errors were encountered: