Skip to content

React Native: Remove babel deps from RN setup (not needed) - #35243

Merged
ndelangen merged 4 commits into
nextfrom
dannyhw/fix/remove-babel-depsforrn
Jun 24, 2026
Merged

ndelangen merged 4 commits into
nextfrom
dannyhw/fix/remove-babel-depsforrn

Conversation

@dannyhw

@dannyhw dannyhw commented Jun 20, 2026 •

Copy link
Copy Markdown
Member

Closes #

What I did

The react native setup fails on npm for peer dependency issues related to babel, however babel and babel loader are not used at all for react native storybook so we can remove those without issue.

Checklist for Contributors

Testing

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

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

Manual testing

In a react native project using npm you can run this and see that everything still works
npm_config_legacy_peer_deps=true node /path-to-storybook/storybook/code/lib/create-storybook/dist/bin/index.js

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

  • Declare whether manual QA will be needed for this PR during the next release, through qa:needed or qa:skip

  • 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

  • Refactor
    • Updated React Native generator's dependency resolution mechanism to modify which packages are included in generated Storybook configurations.
    • Refined how project dependencies are collected during the setup process.

@dannyhw dannyhw added ci:normal Run our default set of CI jobs (choose this for most PRs). bug labels Jun 20, 2026
@coderabbitai

coderabbitai Bot commented Jun 20, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

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: 71faf6ec-86e5-422d-b3fb-bd8cd4187ea5

📥 Commits

Reviewing files that changed from the base of the PR and between 036667d and 58cd68d.

📒 Files selected for processing (1)
  • code/lib/create-storybook/src/generators/REACT_NATIVE/index.test.ts
✅ Files skipped from review due to trivial changes (1)
  • code/lib/create-storybook/src/generators/REACT_NATIVE/index.test.ts

📝 Walkthrough

Walkthrough

The React Native Storybook generator removes the getBabelDependencies import from storybook/internal/cli and eliminates the corresponding call in configure. The packages array passed to dependencyCollector.addDependencies now contains only versionedPackages plus the optional react-dom entry. Tests are updated to remove the mock setup for this removed dependency.

Changes

React Native generator dependency cleanup

Layer / File(s) Summary
Remove getBabelDependencies import and usage
code/lib/create-storybook/src/generators/REACT_NATIVE/index.ts
getBabelDependencies is removed from the import list and is no longer called in configure; packages is built solely from versionedPackages with the existing conditional react-dom addition.
Update tests to remove mock setup
code/lib/create-storybook/src/generators/REACT_NATIVE/index.test.ts
Test file removes the getBabelDependencies import and the beforeEach mock that resolved it to an empty array; other mocks and assertions remain unchanged.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
code/lib/create-storybook/src/generators/REACT_NATIVE/index.ts (1)

135-140: ⚠️ Potential issue | 🟡 Minor

Remove getBabelDependencies mock and import from test file.

The implementation correctly removes babel dependencies (unnecessary for React Native's Metro bundler), but the test file still imports and mocks getBabelDependencies at lines 3 and 38 of index.test.ts. These should be removed to keep tests consistent with the implementation changes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@code/lib/create-storybook/src/generators/REACT_NATIVE/index.ts` around lines
135 - 140, Remove the unused getBabelDependencies import and mock from the test
file index.test.ts to keep tests consistent with the implementation changes.
Specifically, delete the import statement for getBabelDependencies from the top
of the test file (around line 3) and remove the jest.mock call for
getBabelDependencies (around line 38). Since the implementation no longer
collects babel dependencies for React Native, these test artifacts are no longer
needed.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@code/lib/create-storybook/src/generators/REACT_NATIVE/index.ts`:
- Around line 135-140: Remove the unused getBabelDependencies import and mock
from the test file index.test.ts to keep tests consistent with the
implementation changes. Specifically, delete the import statement for
getBabelDependencies from the top of the test file (around line 3) and remove
the jest.mock call for getBabelDependencies (around line 38). Since the
implementation no longer collects babel dependencies for React Native, these
test artifacts are no longer needed.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c20349ce-de4d-445d-9fcb-6ec5349f44c5

📥 Commits

Reviewing files that changed from the base of the PR and between 7e7251e and 036667d.

📒 Files selected for processing (1)
  • code/lib/create-storybook/src/generators/REACT_NATIVE/index.ts

@dannyhw dannyhw changed the title React Native: remove babel deps from RN setup (not needed) React Native: Remove babel deps from RN setup (not needed) Jun 20, 2026
@dannyhw
dannyhw requested review from ndelangen and shilman June 20, 2026 22:11
@dannyhw dannyhw added the qa:skip Pull Requests that do not need any QA. (e.g. documentation) label Jun 20, 2026
This was referenced Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug ci:normal Run our default set of CI jobs (choose this for most PRs). cli qa:skip Pull Requests that do not need any QA. (e.g. documentation) react-native

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants