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

[Bug]: Excessive React library requirement for angular storybook #27213

Closed
blazkovicz opened this issue May 21, 2024 · 5 comments
Closed

[Bug]: Excessive React library requirement for angular storybook #27213

blazkovicz opened this issue May 21, 2024 · 5 comments

Comments

@blazkovicz
Copy link

Describe the bug

We use storybook 8 with angular 17. As I understood, react libraries are required for storybook auto-documentation, but we do not use it. Storybook builds and shows just fine, but webpack build error arises at the end of build which results in storybook process being unmanageable afterwards (can not be stopped from IDE, only process kill in task manager helps). Debugging webpack configuration gives next errors:

Can't resolve 'react' in 'node_modules@storybook\icons\dist'
Can't resolve 'react' in 'node_modules@storybook\manager-api\dist'
Can't resolve 'react' in 'node_modules@storybook\router\dist'

Is it possible to drop react dependency for these packages?

Reproduction link

I do not have reproduction link

Reproduction steps

No response

System

System:
    OS: Windows 10 10.0.19045
    CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
  Binaries:
    Node: 20.11.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 4.1.1 - ~\AppData\Roaming\npm\yarn.CMD <----- active
    npm: 9.6.6 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (125.0.2535.51)
  npmPackages:
    @storybook/addon-actions: ^8.0.8 => 8.0.8
    @storybook/addon-controls: ^8.0.8 => 8.0.8
    @storybook/addon-links: ^8.0.8 => 8.0.8
    @storybook/addon-toolbars: ^8.0.8 => 8.0.8
    @storybook/addon-viewport: ^8.0.8 => 8.0.8
    @storybook/addons: ^7.6.17 => 7.6.17
    @storybook/angular: ^8.0.8 => 8.0.8
    eslint-plugin-storybook: ^0.8.0 => 0.8.0
    storybook-addon-mock: ^5.0.0 => 5.0.0
    storybook-dark-mode: ^4.0.1 => 4.0.1
    storybook-preset-inline-svg: ^1.0.1 => 1.0.1

Additional context

No response

@vanessayuenn
Copy link
Contributor

You're right that starting from 8.0, there should be no need for a react peer dependency for non-react projects. If your issue only occurs after the upgrade, it's possible that this is a hoisting issue that may be resolved by "nuke & reinstall" all the dependencies. That said, I am afraid we will not be able to prioritize this report without a reproduction. If you are able to create one via storybook.new, we can look into it. Thank you for your understanding!

@blazkovicz
Copy link
Author

Regardless reproduction of the problem (it was mentioned as just a case of inconveniency) these common libraries should not use react at all. Setup is: angular project, no autodocs, just component stories, we do not want to keep react dependencies there even as devDependencies.

@Marklb
Copy link
Member

Marklb commented May 30, 2024

Are you wanting to drop React as a dependency in your dependencies or are you stating that you don't want it in the Storybook packages dependencies? With a reproduction or error output, it is difficult to determine if you are experiencing a bug that needs to be fixed or something Storybook can work on removing.

Everything Storybook is doing should be isolated away, so you only have to think about your stories, but technically Storybook is a React application that renders stories as isolated mini applications inside a React component.

I may not be understanding the question, but you should not need to specify it as a dependency in your project. I don't think you would be able to avoid it being a dependency in at least some of Storybook's packages, though. The Storybook UI is a React application and a story is basically a React component that renders a mini application. In your case, that mini application would be an Angular application. Ideally, Storybook hides the need to think about how it does that, but Storybook is basically just a React application that attempts to render isolated mini applications from any framework.

In an Angular project, Storybook is using Compodoc to collect information for auto-documentation. If you choose to do that then the documentation would be renders with React, but that is only a small part of the UI and React is still being used for the other UI parts.

Copy link
Contributor

Hi there! Thank you for opening this issue, but it has been marked as stale because we need more information to move forward. Could you please provide us with the requested reproduction or additional information that could help us better understand the problem? We'd love to resolve this issue, but we can't do it without your help!

@github-actions github-actions bot added the Stale label Jun 21, 2024
Copy link
Contributor

I'm afraid we need to close this issue for now, since we can't take any action without the requested reproduction or additional information. But please don't hesitate to open a new issue if the problem persists – we're always happy to help. Thanks so much for your understanding.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants