fix(babel-preset-storybook-full-source): use named exports for story detection#32267
Conversation
📊 Bundle size report✅ No changes found |
Hotell
left a comment
There was a problem hiding this comment.
IMO the proposed solution won't scale and tries to assume things that will not be clear to follow.
Instead we should update the AST traversal within the plugin to process only storybook components, which AFAIR are only those that are exported ( with optionally containing storybook specific static property assigments ) and live in *.stories.tsx? files.
thoughts?
The suggestion will work if we'd use babel plugin before any other transformers like SWC. In our case we use SWC to transform TS, JSX and imports, and babel plugin transforms source without those. |
hmm not sure I follow ?
|
4009323 to
b99b7b5
Compare
That's actually correct, exports are available at the time when babel transforms stories. I've updated the plugin to use named exports. Thank you for the suggestion! |
Hotell
left a comment
There was a problem hiding this comment.
1 actionable and 1 question. beside that great job !
7b64bf2 to
8ed1fac
Compare
Previous Behavior
After the SB7 migration, a regression occurred where the
Positioning Componentspage is not functioning correctly. This issue arises because thePositionedComponentis defined prior to the story component, leading thebabel-full-source-pluginto mistakenly treat it as a story component.New Behavior
The
babel-plugin-full-sourcedetects stories as React components that are exported using named exports.Related Issue(s)