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

"@nrwl/storybook:storybook" uses proxy package for "@storybook/core-server" #9286

Closed
michaelcamper opened this issue Mar 11, 2022 · 11 comments · Fixed by #9562
Closed

"@nrwl/storybook:storybook" uses proxy package for "@storybook/core-server" #9286

michaelcamper opened this issue Mar 11, 2022 · 11 comments · Fixed by #9562
Assignees
Labels
outdated scope: storybook Issues related to Storybook support in Nx type: enhancement

Comments

@michaelcamper
Copy link

Current Behavior

The storybook executor imports from @storybook/core to spin up a dev server. As this package is used as a proxy for backwards compatibility, I don't think it is good practice. @storybook/core is only installed when using @storybook/addon-essentials (@storybook/addon-docs to me more specific) and therefor breaks if storybook is used without the docs addon.

Expected Behavior

storybook executor should use @storybook/core-server instead of relying on a proxy package.

Steps to Reproduce

  • Uninstall @storybook/addon-essentials from a workspace with a set up storybook project
  • run nx storybook [project]

Failure Logs

Cannot find module '@storybook/core/server

Environment

Node : 16.13.0
OS : darwin arm64
yarn : 1.22.17

nx : 13.8.7
@nrwl/angular : undefined
@nrwl/cli : 13.8.7
@nrwl/cypress : 13.8.7
@nrwl/detox : undefined
@nrwl/devkit : 13.8.7
@nrwl/eslint-plugin-nx : 13.8.7
@nrwl/express : undefined
@nrwl/jest : 13.8.7
@nrwl/js : 13.8.7
@nrwl/linter : 13.8.7
@nrwl/nest : undefined
@nrwl/next : undefined
@nrwl/node : undefined
@nrwl/nx-cloud : undefined
@nrwl/react : 13.8.7
@nrwl/react-native : undefined
@nrwl/schematics : undefined
@nrwl/storybook : 13.8.7
@nrwl/tao : 13.8.7
@nrwl/web : 13.8.7
@nrwl/workspace : 13.8.7
typescript : 4.5.5
rxjs : 6.6.7

@mandarini mandarini self-assigned this Mar 11, 2022
@mandarini mandarini added the scope: storybook Issues related to Storybook support in Nx label Mar 11, 2022
@mandarini
Copy link
Member

Hi there @michaelcamper ! Ha, you got me, is all I'll say :P

That's a known issue, and I'm supposed to be working on it. Will try to have this fixed some time soon.

Potentially related issues:
#8403
#7544

@michaelcamper
Copy link
Author

Wow, you guys are quick to reply! 👏🏼

Cool happy to hear that!

Just out of curiosity, wouldn't be sufficient to just adjust the import statement?

@mandarini
Copy link
Member

Hm, maybe yes maybe no. There's some logic behind this, and right now I'm not 100% sure how we should treat this. I will post updates here, don't worry!

@shilman
Copy link

shilman commented Mar 15, 2022

@mandarini I think it's save to use @storybook/core-server directly if that helps. the rationale on the storybook side: when we did the refactor that split @storybook/core into core-client and core-server in SB6.2, we we kept @storybook/core around to try to avoid breaking changes.

@mandarini
Copy link
Member

Hi there @michaelcamper ! I am just trying out your issue now! So, your issue exists, indeed if I remove @storybook/addon-essentials I get the Cannot find module '@storybook/core/server' error.

However, if I change the import to @storybook/core-server, I still get the not found error, for core-server this time. Do you want to try it out on your own, too, and let me know if it works for you in a different way? I can help you out make the change to the Nx codebase and run it locally to test if you want.

@mandarini
Copy link
Member

Also, I think it sort of makes sense to assume that @storybook/core is available. But I see where you're coming from. In any case, the server implementations will soon change, hopefully. But yes, let's see if you can get it working with the core-server.

Or did you mean to add core-server as a dependency in package.json?

@mandarini
Copy link
Member

Actually, here's the PR. You can test it locally, too. It does not seem to be working for me.

@michaelcamper
Copy link
Author

Hi @mandarini! I've just tested it in my project by replacing the import directly in node_modules/@nrwl/storybook/src/executors/storybook/storybook.impl.js, which seems to work!

The changes in your PR look good to me! Some tests seem to fail, but I cannot see a relation to the change in storybook. Do you?

@mandarini
Copy link
Member

@michaelcamper I first tried changing the import directly in node_modules as well, and it does not work for me. Can you send me a sample reproduction repository, so that I can test it on my side? I will just change the import after I yarn install the deps.

@mandarini
Copy link
Member

mandarini commented Mar 18, 2022

So, I am going to change this to an enhancement, since a simple change in the import does not fix it, and also I really think that expecting storybook/core to be present is reasonable. I'll tell you what, though. It's in the works to change the way we use the server, so this is going to change in any case! Does this sound good? In any case, thank you for this! :) It's a valid point to make!

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: storybook Issues related to Storybook support in Nx type: enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants