Skip to content

[Bug]: Storybook builders use imports incorrectly #31558

@yannbf

Description

@yannbf

Describe the bug

This is a subtle issue, but it could hit anyone using multiple Storybooks in a monorepo with differing versions.

Storybook's virtual entry files created by both builder-webpack5 and builder-vite do a direct import of storybook (webpack, vite).

That virtual file is executed at the project root, and not at the location of the builder's node module. This means the import will resolve to node_modules/storybook which is not at all guaranteed to be the right version of the Storybook you're running.

Those virtual entry files should be updated to take the resolved path to the storybook package as input.

This might not be the only place this sort of thing happens, so we should take a deeper look into it.

Reproduction link

Reproduction steps

No response

System

-

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugbuilder-vitebuilder-webpack5internal-qaThis issue was reported by the Storybook team, potentially on unreleased or prerelease software.

    Type

    No type

    Projects

    Status

    Empathy Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions