Skip to content
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

React: Make @babel/core an optional peer dependency #13329

Merged
merged 1 commit into from
Dec 1, 2020

Conversation

arcanis
Copy link
Contributor

@arcanis arcanis commented Nov 29, 2020

It seems that @babel/core is only used in two locations in the react app:

storybook/app/react/src/server/framework-preset-react-docgen.ts:import type { TransformOptions } from '@babel/core';
storybook/app/react/src/server/framework-preset-react.ts:import { TransformOptions } from '@babel/core';

Both of those only import types from @babel/core (and only in the server files, which don't seem to be publicly exposed), making it at best an optional peer dep (I think you could remove it altogether, but I haven't investigated to that effect).

What I did

Used peerDependenciesMeta to mark the peer dep as optional.

How to test

n/a

@gaetanmaisse gaetanmaisse added the maintenance User-facing maintenance tasks label Nov 29, 2020
Copy link
Member

@gaetanmaisse gaetanmaisse left a comment

Choose a reason for hiding this comment

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

Note to myself (or to other SB members 😛 ):
Usage of @babel/core needs to be checked and cleaned across the whole monorepo. Some packages have it as regular or peer dep but aren't importing anything from it (maybe to satisfy transitive peerDep? to check) and others (as @storybook/react) are only importing a type, which isn't used/reexported publicly.

Copy link
Member

@shilman shilman left a comment

Choose a reason for hiding this comment

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

LGTM. @gaetanmaisse can you do the follow-on work for this? 🙏

@shilman shilman merged commit aec333f into storybookjs:next Dec 1, 2020
@shilman shilman changed the title Makes @babel/core an optional peer dependency React: Make @babel/core an optional peer dependency Dec 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
maintenance User-facing maintenance tasks
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants