-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 fails to execute when running in an Nx workspace #4305
Comments
Thanks for submitting the issue! You you change the configuration version property to 1 (line 2 of workspace.json) and run nx format, you will get the old version of the configuration. You just need to do it once. Everything should work after that. We support the Angular CLI configuration (Nx can run with angular.json). Everything that requires Angular CLI should work in this case. It's basically an Angular CLI project. If you are using an Nx workspace without the Angular CLI (workspace.json instead of angular.json), not everything that would work in the Angular CLI will work here. It's not an Angular CLI project any more. We do our best to make sure as much as possible works. We provide a custom host for schematics that converts workspace.json to angular.json on the fly and converts it back etc., but the Angular storybook integration doesn't work. The reason to have a different config format is that the Angular CLI configuration doesn't work well for large workspaces. The angular.json file should not be the place where 1000 projects are configured. In Q1 we will allow project configuration to be located within the project's folder. The change required in the Angular Storybook is actually small, so if the folks there are happy to receive a PR, we will send one. As a side note, the Angular team started work on making the config customizable. But the API was convoluted, so the Angular CLI doesn't use the API consistently, and no tool I know of uses it well either. @mandarini @juristr can we ping the storybook folks to see if they are happy to receive a PR? |
Thank you for the follow up, explanation, and workaround. I appreciate the insight. We switched to a non-Angular workspace with the intent on supporting non-Angular libraries/projects alongside our Angular projects. We use storybook a lot so this was something we noticed right away. I have no issues with swapping the version back to v1 while we await the upcoming features in Q1 as you mentioned. Thank you for this tip. Lastly, may I take a moment to applaud your engagement and responsiveness with the community. The team at Nrwl has done an excellent job at communicating and fielding questions from us. My hope is that other community projects take inspiration from, and lead with, this level of professionalism and engagement. I know my team and I certainly will. Cheers! |
@vsavkin - This maybe a separate issue, but I am getting a different error in the same step. See below:
Note that |
Sorry, my issue above was due to the fact that I changed my default project to a library instead of an application. Once I changed the default to an application everything worked as it should. I looked through the documentation and It maybe worth mentioning for Angular users how storybook/webpack bootstraps via the default project. |
this issue relate to this PR #4099 which is fix Storybook always using default project as target |
@vsavkin I'll reach out to the Storybook folks. @hiepxanh I'll try to take a look at your PR. |
thank you, happy new year :D hope you safe and heathy ❤️ |
…nfig to desired format Storybook expects the format of workspace.json to match angular.json. This is not the case. Storybook now will read the workspace.json file using the new function. This will allow us to manage the new formats. ISSUES CLOSED: nrwl#4305
Storybook expects the format of workspace.json to match angular.json. This is not the case. Storybook now will read the workspace.json file using the new function. This will allow us to manage the new formats. ISSUES CLOSED: nrwl#4305
Storybook expects the format of workspace.json to match angular.json. This is not the case. Storybook now will read the workspace.json file using the new function. This will allow us to manage the new formats. ISSUES CLOSED: #4305
Hi folks, I run into this issue today. From what I understood, the PRs to storybook should have resolved the original issue and allow to use Storybook with Nx config (v2), but it still happened for me. I created a fresh project from Angular schematic with Nx 12. I also made sure I have latest Storybook (6.2.9) installed which includes the merged changes. Could there be anything else that needs to be done? |
Same thing here after bumping minor versions in an Nx 11 project. Only thing that worked for me was rolling back both the
I tried a bunch of other combinations to try to figure out whether the problem is with Nx or with Storybook.
Hence it would seem that the problem lies in a combination of Nx and Storybook. |
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. |
Current Behavior
When an Nx empty workspace is created, and an Angular app is added with Storybook support, Storybook fails to start with the following error:
ERR! TypeError: Cannot read property 'build' of undefined
See Failure Log section below for more details.
Expected Behavior
Storybook can start successfully.
Unclear if this is a regression as this is the first time I'm using an Nx workspace as opposed to an Nx Angular workspace.
Steps to Reproduce
Failure Logs
Environment
Other Notes
Error appears to occur since it is looking for an
architect
property within theworkspace.json
however this appears to have been renamed totargets
. Note, renamingtargets
back toarchitect
within workspace.json does fix the issue. However, it is unclear if this will cause problems for other Nx systems.Based on my testing so far (running an Angular app, linting, and jest tests) renaming the property back to
architect
has not had any issues but I assume this was renamed for a purpose so I can't be sure that this is a good long term fix.The text was updated successfully, but these errors were encountered: