Skip to content

[Bug]: Followup CSF factories: codemod generates broken code in projects where the preview file doesn't have exports #33640

@ndelangen

Description

@ndelangen

Describe the bug

If a project has a preview.js file like so:

import './preview.scss'

Then the changes for that preview file will not provide a default export, which is required by any story file like:

import preview from '../../../../../.storybook/preview'

And therefore cause the stories to be broken

Image

Same issue happens when the preview file is empty:

Image

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions