-
-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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]: Unable to abstract the CSF Default Export with a function #21703
Comments
this holds us back from upgrading to Storybook 7 and CSF 3 |
This is an intentional change. I've updated the code to make the error a little more descriptive: #22190 SB7 statically analyzes the story files for performance reasons and we can't statically analyze functions. You'll need to rewrite your default exports if you've written functions to generate them -- we should have been more explicit about disallowing this kind of code in earlier Storybook versions, but unfortunately that ship has sailed. The performance benefits of the new approach greatly outweigh the costs, so I don't expect this to change in future versions of Storybook. Closing this for now! |
with this feature flag i was able to keep my old abstraction
https://storybook.js.org/docs/angular/configure/overview#on-demand-story-loading @shilman is that the way to go? Or is it a side effect? I understand the performance benefits, but i dislike the idea of being forced to a certain code format. I need to wrap the stories with a custom DSL to reduce some boilerplate code and add typesafety. |
Whoopee!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.1.0-alpha.8 containing PR #22190 that references this issue. Upgrade today to the
|
Jeepers creepers!! I just released https://github.com/storybookjs/storybook/releases/tag/v7.0.7 containing PR #22190 that references this issue. Upgrade today to the
|
Storybook becomes more and more verbose without a need. We have a lot of configurations that we want to abstract, a simple wrapper for the |
Absolutely agree, this is just SO rediculous... |
Any news on this? Wanted to wrap our stories in a helper too and got same error.. |
There's a workaround, that works for now const meta: CosMeta = {
title: 'Required Title',
...your props
};
cosMeta(meta);
export default meta;
export const Primary = cosStory(); Basically we mutate the statically defined |
Tried to upgrade Storybook, and now I need to update 160+ files to remove a carefully crafted abstraction. @shilman the error message we're showing here still isn't helpful. I am returning an object from the function that I added to add type-safety and other guardrails. |
Describe the bug
Hi, I want to abstract the CSF default export object for Storybook, like below:
metaFunction.js
Button.stories.js:
The problem is that when I use the
getMeta
function, Storybook crashes with the error "CSF: missing default export". It seems like I must declare an object and cannot abstract it at all, or even use a spread object inside the initial meta object.Is there any way to abstract the CSF default export object with a function?
To Reproduce
Go to this repo and the function_debug branch, run
npm install
and thennpm run storybook
.System
`^7.0.0-rc.5`
Additional context
No response
The text was updated successfully, but these errors were encountered: