-
-
Notifications
You must be signed in to change notification settings - Fork 9.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
[Angular13] External style directories not working any more #16871
Comments
I typically try to avoid adding additional style loaders to Angular, since it comes with it's own Webpack config for loading styles. Would the builder Storybook provides now work? It supports "styles" and "stylePreprocessorOptions" for "application" and "library" projects. I added the following to your repro's {
...,
"projects": {
"angular13-storybook-test": {
"projectType": "application",
...,
"architect": {
"build": {
...
},
...,
"storybook": {
"builder": "@storybook/angular:start-storybook",
"options": {
"browserTarget": "angular13-storybook-test:build",
"styles": ["src/styles.scss"],
"stylePreprocessorOptions": {
"includePaths": ["projects/style-lib/src/lib"]
},
"compodoc": false, // This is because of #16728 on Windows and maybe Stackblitz, but you may not not to disable compodoc.
"port": 4400
}
},
"build-storybook": {
"builder": "@storybook/angular:build-storybook",
"options": {
"browserTarget": "angular13-storybook-test:build",
"styles": ["src/styles.scss"],
"stylePreprocessorOptions": {
"includePaths": ["projects/style-lib/src/lib"]
}
}
}
}
}
},
"defaultProject": "angular13-storybook-test"
}
Here is a working Stackblitz for your repro: https://stackblitz.com/edit/github-8cmy1x?file=package.json&preset=node
|
Thank you @Marklb! Also, I would like to avoid using this solution, as we did not define any build architectures for our libraries. Thanks in advance! |
@habtim I don't think there are docs for the builders yet, but the docs should be updated with them soon. Defining a "browserTarget" isn't required. I updated that Stackblitz project to show it loading stories from the app and lib directories. I also stripped out most of the config in If you do need the loader then someone else may be able to help. I normally run into more trouble than it's worth trying to get style loaders to work, since Angular provides their own way to add styles, but someone more familiar with using them may know the problem. |
Hi everyone! Seems like there hasn't been much going on in this issue lately. If there are still questions, comments, or bugs, please feel free to continue the discussion. Unfortunately, we don't have time to get to every issue. We are always open to contributions so please send us a pull request if you would like to help. Inactive issues will be closed after 30 days. Thanks! |
@habtim were you able to get around this issue? |
Hey @rlam3, |
Describe the bug
This bug occured when upgrading to Angularv13.
First of all we ran into the same problem, stated here
After resolving this issue with
TsconfigPathsPlugin
, we ran into a problem with our styles/scss.We usually use the inline statement
import '!style-loader!css-loader!sass-loader!PATH_TO_STYLE_FILE
to include our styles, which throughs the following kind of errors:Adding the styles explicitly to webpack, via
does resolve in a new error:
To Reproduce
See reproduction repo here
System
Additional context
This error occurred when updating to Angular v13
The text was updated successfully, but these errors were encountered: