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 build error on fresh Angular CLI project #15246
Comments
Angular 12 support was added in 6.3. To use the RC:
|
@shilman thank you for your answer, but unfortunately that still produces the same error. Build output (starting from @storybook/angular version): info @storybook/angular v6.3.0-rc.6 WARN Broken build, fix the error above. |
I'm having the exact same issue with Angular 12 and with I've tried upgrading the Storybook to |
@fikkatra @shilman I've managed to make it work by just adding tsConfig to the angular.json like this 👇
It seems like the storybook builder doesn't know to take into account the |
@mfrancekovic that worked, thanks!
|
I think this issue should be reopened. Storybook should handle the case where tsConfig isn't included in the |
@kroeder @ThibaudAV can one of you take a look? |
@literalpie and others. I've some question 🙋♂️ Some context :In order to avoid redoing the same code as angular-cli. Storybook uses parts of the code of this one with the
for example. And also to use the Currently to find out which projects to plug into. Storybook is not very smart. Either there is a If storybook doesn't find the And in our case. Storybook has all the elements (project + architect.build ) and will try to use the config of the builder But this seems to me more of a fluke than an actual intended use case 😁 or not 🤷♂️ For information I don't know all the history. I just refactored and added test on this part to clarify it and allow the addition of new feature 🙈 And now questions
I started to introduce a native sb builder. It's a good way to launch several storybooks with different configuration. I need feedback to make the best solution 🙏 🥔 🥔 🥔 |
I haven't looked to deep into this and am about about the same point @ThibaudAV on deciding how this should be solved, but the styles and assets are the main properties that I can think would confuse users that don't understand Storybook's build process. The only thing I can think of to prevent that confusion would be to log a warning when initializing Storybook in a project targeting a library and hope they see it. The warning could either explain potential issues with using a library project or point to instructions on adding an application project to If we were to account for library projects and read necessary config from it's alternate properties then I can see issues with "assets" and "styles". "assets":ng-packagr does support assets, but the configuration is limited to just string paths. That may be fine for majority of libraries, but I use a builder that wraps ng-packagr with support for the object syntax that applications can define. "styles":I am not sure if there is a way to support the global styles that applications can provide, because a library has no need for global styles. Libraries would just add them to assets for the consuming application to import into it's global styles. To me it makes sense that "styles" would not be imported automatically for a library, but someone that only uses angular-cli commands to change configuration may not think about why an application. One example would be #14912. When adding angular libraries to a project, configuration schematics can be run to set any required configuration if you add the library with |
I think the ideal solution would be to look at the 'defaultConfiguration', and then get the tsconfig by looking at I also like the direction of going with a native sb builder. That seems to align much more closely with the angular ecosystem. |
I would like to add defaultConfiguration support. it is missing this pr : #15184 but it's not finish currently .. :/ |
Ta-da!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.4.0-rc.9 containing PR #16675 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
When adding Storybook to an Angular project that was created with the Angular CLI (monorepo approach with a single library), running
npm run storybook
produces the following error:Repro steps:
Build output:
1.1.11
TypeScript version used by Compodoc : 2.9.1
TypeScript version of current project : 4.2.3
Node.js version : v12.18.3
Operating system : macOS Catalina
[09:26:42] No configuration file found, switching to CLI flags.
[09:26:42] Using tsconfig file : /pocs/design-system/tsconfig.json
[09:26:42] Including : /pocs/design-system/.editorconfig
[09:26:42] Including : /pocs/design-system/.gitignore
[09:26:42] Including : /pocs/design-system/README.md
[09:26:42] Including : /pocs/design-system/angular.json
[09:26:42] Including : /pocs/design-system/package.json
[09:26:42] Including : /pocs/design-system/tsconfig.json
[09:26:42] Including : /pocs/design-system/.storybook/main.js
[09:26:42] Including : /pocs/design-system/.storybook/preview.js
[09:26:42] Including : /pocs/design-system/.storybook/tsconfig.json
[09:26:42] Ignoring : /pocs/design-system/.storybook/typings.d.ts
[09:26:42] Including : /pocs/design-system/stories/Button.stories.ts
[09:26:42] Including : /pocs/design-system/stories/Header.stories.ts
[09:26:42] Including : /pocs/design-system/stories/Page.stories.ts
[09:26:42] Including : /pocs/design-system/stories/Introduction.stories.mdx
[09:26:42] Including : /pocs/design-system/stories/button.component.ts
[09:26:42] Including : /pocs/design-system/stories/button.css
[09:26:42] Including : /pocs/design-system/stories/header.component.ts
[09:26:42] Including : /pocs/design-system/stories/header.css
[09:26:42] Including : /pocs/design-system/stories/page.component.ts
[09:26:42] Including : /pocs/design-system/stories/page.css
[09:26:42] Including : /pocs/design-system/projects/pattern-lib/README.md
[09:26:42] Including : /pocs/design-system/projects/pattern-lib/package.json
[09:26:42] Including : /pocs/design-system/projects/pattern-lib/karma.conf.js
[09:26:42] Including : /pocs/design-system/projects/pattern-lib/ng-package.json
[09:26:42] Including : /pocs/design-system/projects/pattern-lib/tsconfig.lib.json
[09:26:42] Including : /pocs/design-system/projects/pattern-lib/tsconfig.lib.prod.json
[09:26:42] Including : /pocs/design-system/projects/pattern-lib/tsconfig.spec.json
[09:26:42] Including : /pocs/design-system/stories/assets/colors.svg
[09:26:42] Including : /pocs/design-system/stories/assets/code-brackets.svg
[09:26:42] Including : /pocs/design-system/stories/assets/comments.svg
[09:26:42] Including : /pocs/design-system/stories/assets/flow.svg
[09:26:42] Including : /pocs/design-system/stories/assets/direction.svg
[09:26:42] Including : /pocs/design-system/stories/assets/plugin.svg
[09:26:42] Including : /pocs/design-system/stories/assets/repo.svg
[09:26:42] Including : /pocs/design-system/stories/assets/stackalt.svg
[09:26:42] Including : /pocs/design-system/projects/pattern-lib/src/public-api.ts
[09:26:42] Including : /pocs/design-system/projects/pattern-lib/src/test.ts
[09:26:42] Ignoring : /pocs/design-system/projects/pattern-lib/src/lib/pattern-lib.component.spec.ts
[09:26:42] Including : /pocs/design-system/projects/pattern-lib/src/lib/pattern-lib.component.ts
[09:26:42] Ignoring : /pocs/design-system/projects/pattern-lib/src/lib/pattern-lib.service.spec.ts
[09:26:42] Including : /pocs/design-system/projects/pattern-lib/src/lib/pattern-lib.module.ts
[09:26:42] Including : /pocs/design-system/projects/pattern-lib/src/lib/pattern-lib.service.ts
[09:26:42] Searching package.json file
[09:26:42] package.json file found
[09:26:42] Processing package.json dependencies
[09:26:42] Searching README.md, CHANGELOG.md, CONTRIBUTING.md, LICENSE.md, TODO.md files
[09:26:42] README.md file found
[09:26:42] Error during /pocs/design-system/CHANGELOG read
[09:26:42] Continuing without CHANGELOG.md file
[09:26:42] Error during /pocs/design-system/CONTRIBUTING read
[09:26:42] Continuing without CONTRIBUTING.md file
[09:26:42] Error during /pocs/design-system/LICENSE read
[09:26:42] Continuing without LICENSE.md file
[09:26:42] Error during /pocs/design-system/TODO read
[09:26:42] Continuing without TODO.md file
[09:26:42] Get dependencies data
[09:26:42] parsing : /pocs/design-system/stories/Button.stories.ts
[09:26:42] parsing : /pocs/design-system/stories/Header.stories.ts
[09:26:42] parsing : /pocs/design-system/stories/Page.stories.ts
[09:26:42] parsing : /pocs/design-system/stories/button.component.ts
[09:26:42] found : ButtonComponent
[09:26:42] parsing : /pocs/design-system/stories/header.component.ts
[09:26:42] found : HeaderComponent
[09:26:42] parsing : /pocs/design-system/stories/page.component.ts
[09:26:42] found : PageComponent
[09:26:42] parsing : /pocs/design-system/projects/pattern-lib/src/public-api.ts
[09:26:42] parsing : /pocs/design-system/projects/pattern-lib/src/test.ts
[09:26:42] parsing : /pocs/design-system/projects/pattern-lib/src/lib/pattern-lib.component.ts
[09:26:42] found : PatternLibComponent
[09:26:42] parsing : /pocs/design-system/projects/pattern-lib/src/lib/pattern-lib.module.ts
[09:26:42] found : PatternLibModule
[09:26:42] : - exports:
[09:26:42] : - PatternLibComponent
[09:26:42] : - declarations:
[09:26:42] : - PatternLibComponent
[09:26:42] parsing : /pocs/design-system/projects/pattern-lib/src/lib/pattern-lib.service.ts
[09:26:42] found : PatternLibService
[09:26:42] -------------------
[09:26:42] Project statistics
[09:26:42] - files : 39
[09:26:42] - module : 1
[09:26:42] - component : 4
[09:26:42] - injectable : 1
[09:26:42] -------------------
[09:26:42] Prepare components
[09:26:42] ButtonComponent has styleUrls, include them
[09:26:42] HeaderComponent has styleUrls, include them
[09:26:42] PageComponent has styleUrls, include them
[09:26:42] Prepare modules
[09:26:42] Prepare injectables
[09:26:42] Prepare miscellaneous
[09:26:42] Process documentation coverage report
[09:26:42] Generating documentation in export format json
[09:26:42] Documentation generated in ./ in 0.214 seconds
info @storybook/angular v6.2.9
info
info => Loading presets
info => Loading 1 config file in "/pocs/design-system/.storybook"
info => Loading 7 other files in "/pocs/design-system/.storybook"
info => Adding stories defined in "/pocs/design-system/.storybook/main.js"
info => Using prebuilt manager
info => Found custom tsconfig.json
info => Using implicit CSS loaders
info => Using angular project 'pattern-lib' for configuring Storybook.
ERR! TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
ERR! at validateString (internal/validators.js:120:11)
ERR! at Object.resolve (path.js:980:7)
ERR! at Object.getAngularCliWebpackConfigOptions (/pocs/design-system/node_modules/@storybook/angular/dist/ts3.9/server/angular-cli_config.js:120:39)
ERR! at Object.webpackFinal (/pocs/design-system/node_modules/@storybook/angular/dist/ts3.9/server/framework-preset-angular-cli.js:8:56)
ERR! at /pocs/design-system/node_modules/@storybook/core-common/dist/cjs/presets.js:274:28
ERR! TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
ERR! at validateString (internal/validators.js:120:11)
ERR! at Object.resolve (path.js:980:7)
ERR! at Object.getAngularCliWebpackConfigOptions (/pocs/design-system/node_modules/@storybook/angular/dist/ts3.9/server/angular-cli_config.js:120:39)
ERR! at Object.webpackFinal (/pocs/design-system/node_modules/@storybook/angular/dist/ts3.9/server/framework-preset-angular-cli.js:8:56)
ERR! at /pocs/design-system/node_modules/@storybook/core-common/dist/cjs/presets.js:274:28 {
ERR! code: 'ERR_INVALID_ARG_TYPE'
ERR! }
The text was updated successfully, but these errors were encountered: