Skip to content

Add @storybook/react-vite as an optional peer dependency#34542

Closed
mrmckeb wants to merge 2 commits into
storybookjs:nextfrom
mrmckeb:patch-1
Closed

Add @storybook/react-vite as an optional peer dependency#34542
mrmckeb wants to merge 2 commits into
storybookjs:nextfrom
mrmckeb:patch-1

Conversation

@mrmckeb
Copy link
Copy Markdown
Contributor

@mrmckeb mrmckeb commented Apr 15, 2026

When running pnpm in stricter modes, I see this error:

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@storybook/react-vite'
imported from
/Users/[user]/Library/pnpm/store/v10/links/@/storybook/10.3.5/[hash]/node_modules/storybook/dist/_node-chunks/chunk-YBRG5EIF.js

This because pnpm doesn't link this package, as it isn't declared as a peer dependency.

As a workaround, users can add this to pnpm-workspace.yaml:

packageExtensions:
  storybook:
    optionalDependencies:
      "@storybook/react-vite": "^10"

What I did

Added @storybook/react-vite as an optional peer dependency to the storybook package.

Checklist for Contributors

Testing

See manual testing.

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

Use these settings in pnpm-workspace.yaml:

# Symlinks all packages.
enableGlobalVirtualStore: true

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli-storybook/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook publish.yml --field pr=<PR_NUMBER>

Summary by CodeRabbit

  • Chores
    • Added optional Storybook React Vite support as a peer dependency.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 15, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a3da10f9-aade-4b18-9837-acc0e30b7832

📥 Commits

Reviewing files that changed from the base of the PR and between a168d41 and 779535e.

📒 Files selected for processing (1)
  • code/core/package.json

📝 Walkthrough

Walkthrough

The pull request adds @storybook/react-vite@^10 as an optional peer dependency to the core package's manifest file, enabling packages to leverage this framework integration without requiring it as a hard dependency.

Changes

Cohort / File(s) Summary
Package Dependencies
code/core/package.json
Added @storybook/react-vite@^10 as an optional peer dependency with corresponding metadata declaration.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@valentinpalkovic
Copy link
Copy Markdown
Contributor

Hi @mrmckeb

Have you followed the following guide to fix the issue in your environment?
https://storybook.js.org/docs/faq#how-do-i-fix-module-resolution-in-special-environments

@mrmckeb
Copy link
Copy Markdown
Contributor Author

mrmckeb commented Apr 16, 2026

Hi @valentinpalkovic!

That should help, but I wanted to fix this for others too. I expect we'll see more people moving to stricter modes now that pnpm has the virtual global store.

Note that I didn't have this problem with the @storybook/addon-* packages.

@valentinpalkovic
Copy link
Copy Markdown
Contributor

Hi @mrmckeb,

Thanks for your message!

Right. But the proposed solution goes in a difficult direction, because, theoretically, each and every addon and framework package would have to be declared as a peer dependency in storybook. We are aware of the issue, but the fix is different (actually avoiding magic package strings). Hopefully, we can tackle the issue in the near future! Closing, since the provided solution is not how we envision fixing the issue.

@github-project-automation github-project-automation Bot moved this from Empathy Queue (prioritized) to Done in Core Team Projects Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants