storybook: Failed to get angular-cli webpack config since @angular-devkit/build-angular 0.8.0-beta.2
Bug summary
Since the release of @angular-devkit/build-angular 0.8.0-beta.2 storybook-angular fails at getting angular-cli webpack config.

It’s just a warning and do no prevent storybook to run BUT as config from angular.json is not loaded it causes styles and app specific configs not to be used. And so in my company project every SASS/CSS styles are failing.
Expected Behavior
Webpack config loading should be working great, like with previous version of @angular-devkit/build-angular
Steps to reproduce
Just follow the getting started:
-
Generate an angular project with
@angular/cli:npm i -g @angular/cling new your-angular-prj
-
Add storybook to the project:
npm i -g @storybook/cligetstorybook
-
Add bable deps:
npm i -D @babel/core babel-loader@next
-
Start storybook:
npm run storybook
Please specify which version of Storybook and optionally any affected addons that you’re running
- @storybook/angular: v4.0.0-alpha.24
- @storybook/addon-actions: v4.0.0-alpha.24
- @storybook/addon-links: v4.0.0-alpha.24
- @storybook/addon-notes: v4.0.0-alpha.24
- @storybook/addons: v4.0.0-alpha.24
Affected platforms
- All angular projects generated with
@angular/cli v6.2.0-beta.2or newer
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 3
- Comments: 19 (6 by maintainers)
same problem with angular 7.2.0 and @storybook/angular 4.1.6
Steps to reproduce
@angular/cli:ng new your-angular-prjsb initnpm run storybookI am also having this issue. Should this be reopened?
I’m getting this issue, while trying to work with Angular v. 7.2.0 and Storybook v. 4.1.6 - which already has the solution posted. Working on base apps for both frameworks with no customization in place yet to explain away the issue.
Specifying
@angular-devkitversion worked as a workaround for us for now.Add these to devDependencies then do npm install
Added tsConfig path to architect.build.builder.options
Having the same issue (
Failed to get angular-cli webpack config.) in the latest Storybook with the latest @angular-devkit/build-angular. Will try to look into this when I have a chance.@jkvim The issue causing
Failed to get angular-cli webpack configis not the same for all of us. I was on 0.13.8, and I assume @martinmcwhorter was user a newer version too.Anyway, I finally got around to looking into this, and I have identified the issue in my case.
The error was, as in other cases, indeed caused here when Storybook’s getAngularCliParts() calls @angular-devkit/build-angular’s getCommonConfig. However, for me, within this function the error was thrown by path.resolve() here because the argument buildOptions.outputPath was undefined.
Now why was outputPath undefined? This is where it’s Storybook’s fault. Storybook here assumes that sufficient build options can be found in
project.architect.build.options. However, this is really only for the a project’s build’s default options. If your build has multiple configurations (which mine did), the bulk of your settings may be located withinproject.architect.build.configurations.<configurationName>where the configuration name will be something likeprodorstaging.Now, in my case, as Storybook doesn’t seem to use outputPath for anything, I can just set
project.architect.build.options.outputPathto a dummy string to solve this issue. You might argue that it is good practice to have one of my configurations as the “base” configuration, described inproject.architect.build.optionsrather than withinproject.architect.build.configurations.<baseConfiguration>. However, I think the bigger issue at play here is that Storybook does not respect project configurations. It barely supports multiple projects (FYI monorepos can have multiple projects defined within one angular.json file), so this is hardly surprising.I think the best solution is for Storybook to allow specification of both the Angular project and its configuration. (With regards to the project selection, Angular currently takes the project marked in angular.json’s
defaultProjectproperty, which is hardly convenient as it requires us to change angular.json in order to have Storybook target a different project.). I will probably make a PR for this in the not-too-distant future.Doesn’t make a difference
I get the following when I try to run storybook@next:
Error: Cannot find module ‘emotion-theming/package.json’ EntryModuleNotFoundError: Entry module not found: Error: Can’t resolve ‘./src’ in [project]
Huzzah!! I just released https://github.com/storybooks/storybook/releases/tag/v5.0.0-rc.7 containing PR #5776 that references this issue. Upgrade today to try it out!
Because it’s a pre-release you can find it on the
@nextNPM tag.Looks like this bug was fixed yesterday by commit https://github.com/storybooks/storybook/commit/22d4de112b51a1790aade6ef31211323fea44483 of @igor-dv, thanks! Just have to wait for the next release now.