-
-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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/angular] storybook fails because of missing "node-sass", for Angular v8.0 when defaultProject
is a library project
#6978
Comments
I had a similar problem where my storybook configuration was different than the default project even when it wasn't a lib. There's a fix in 5.1 that will prefer a project named "storybook" to pull the build config from rather than relying on the defaultProject. Try adding a config for a project named "storybook" to angular.json |
Today I generated a new angular 8 project with angular cli. To get storybook running I had to manualy install Logs:
logs after installing babel-loader manually:
|
I fixed it by just adding node-sass to my devDependencies |
@kroeder is this also a problem with |
I just encountered this error also, when attempting to switch from |
@kroeder @MaximSagan @CodeByAlex I'm seeing this when trying to run |
As a workaround, what you can do is: Create a new project entry in angular.json {
"projects": {
"your-app": {...},
"your-lib": {...},
"storybook": {
"projectType": "application",
"root": "copy-from-your-app",
"sourceRoot": "copy-from-your-app",
"architect": {
"build": {
"options": { ...copy from your-app }
}
}
}
},
"defaultProject": "your-lib"
} With this change, you basically tell storybook what's your intended project in your multi-projects angular workspace to let storybook start/build. |
Please create a reproduction on Stackblitz (https://storybook.new) for Storybook 7. I will close this in the meantime. Please feel free to reopen the issue, if it is still reproducible in SB 7. |
Describe the bug
This is a bit complex bug.
This bug is based on the following conditions;
node-sass
doesn't exist inpackage.json
angular.json
,defaultProject
is set to a project which hasprojectType: library
.styleUrls
and it refers external.scss
files which contains@import "..."
.Running
yarn storybook
, it fails with log like the below;To Reproduce
Steps to reproduce the behavior:
ng generate library sample-lib
yarn add @storybook/cli
yarn sb init
5 Create
sample-lib.component.scss
file and add it toSampleLibComponent
'sstyleUrls
foo.scss
and import it fromsample-lib.component.scss
SampleLibComponent
yarn storybook
Repro: https://github.com/lacolaco/ngv8lib-storybook-repro
Expected behavior
Even if the
defaultProject
is a library, storybook should work.System:
Additional context
The problem is here;
https://github.com/storybookjs/storybook/blob/master/app/angular/src/server/angular-cli_config.js#L92
With a library project,
cliParts
will benull
because ofgetAngularCliParts
. Internally, it uses this function:https://github.com/storybookjs/storybook/blob/master/app/angular/src/server/angular-cli_utils.js#L53-L65
It depends on
@angular_devkit/build-angular
but thecliWebpackConfigOptions
is defined for@angular_devkit/build_ng_packagr
. It makes schema mismatching.I think storybook should have its own default
cliWebpackConfigOptions
which will be used when it'sprojectType
is notapplication
.The text was updated successfully, but these errors were encountered: