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

storybook-configuration should stop installing React #29213

Closed
1 of 4 tasks
prewk opened this issue Dec 5, 2024 · 1 comment · Fixed by #29231
Closed
1 of 4 tasks

storybook-configuration should stop installing React #29213

prewk opened this issue Dec 5, 2024 · 1 comment · Fixed by #29231
Assignees

Comments

@prewk
Copy link

prewk commented Dec 5, 2024

Current Behavior

Thanks for nx, it's great!

My previous issue #28654 was erroneously closed with an untrue remark that Storybook requires React. It does not.

As of Storybook 8, Storybook no longer requires React in non-React projects (scroll down to "No more React requirement in non-React projects"). nx supports Storybook 8.

Every time we add storybook to an nx lib in our Angular monorepo, nx adds React to it, so we have to clean it up.

Expected Behavior

No packages should be installed.

GitHub Repo

https://github.com/prewk/nx-storybook-test

Steps to Reproduce

I've created a lib called foo in the repro repo.

npx nx g @nx/angular:storybook-configuration foo
It'll install React (and some other packages but that makes sense)

Nx Report

Company repo which we want to solve:


Node           : 20.14.0
OS             : darwin-arm64
Native Target  : aarch64-macos
yarn           : 4.4.0

nx                 : 20.0.3
@nx/js             : 20.0.3
@nx/jest           : 20.0.3
@nx/eslint         : 20.0.3
@nx/workspace      : 20.0.3
@nx/angular        : 20.0.3
@nx/devkit         : 20.0.3
@nx/eslint-plugin  : 20.0.3
@nx/plugin         : 20.0.3
@nx/storybook      : 20.0.3
typescript         : 5.5.4
---------------------------------------
Community plugins:
@ngneat/spectator        : 14.0.0
@ngrx/component          : 18.1.0
@ngrx/component-store    : 18.1.0
@ngrx/effects            : 18.1.0
@ngrx/entity             : 18.1.0
@ngrx/operators          : 18.1.0
@ngrx/router-store       : 18.1.0
@ngrx/schematics         : 18.1.0
@ngrx/signals            : 18.1.0
@ngrx/store              : 18.1.0
@ngrx/store-devtools     : 18.1.0
@storybook/angular       : 8.3.6
@testing-library/angular : 14.2.0
---------------------------------------


The reproduction repo:


Node           : 20.14.0
OS             : darwin-arm64
Native Target  : aarch64-macos
npm            : 10.8.2

nx                 : 20.0.6
@nx/js             : 20.0.6
@nx/jest           : 20.0.6
@nx/eslint         : 20.0.6
@nx/workspace      : 20.0.6
@nx/angular        : 20.0.6
@nx/cypress        : 20.0.6
@nx/devkit         : 20.0.6
@nx/eslint-plugin  : 20.0.6
@nx/storybook      : 20.0.6
@nx/web            : 20.0.6
@nx/webpack        : 20.0.6
typescript         : 5.5.4
---------------------------------------
Registered Plugins:
@nx/storybook/plugin

Failure Logs

Package Manager Version

yarn v4.4.0 / npm 10.8.2

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@prewk
Copy link
Author

prewk commented Dec 6, 2024

Awesome, thanks!

FrozenPandaz pushed a commit that referenced this issue Dec 6, 2024
## Current Behavior
Storybook 7 requires `react` and `react-dom` to be installed as they are
peer deps of the storybook package.
Storybook 8 does not require these deps to be installed as they are now
bundled correctly into storybook

## Expected Behavior
When user's version of storybook < 8, install `react` and `react-dom`,
otherwise, do not.

## Related Issue(s)

Fixes #29213

(cherry picked from commit 51cf34f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants