-
-
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
@storybook/angular: Expected 'styles' to be an array of strings #7877
Comments
This happens with Angular CLI 8.3.0. As a temp work around you can use 8.2.x
|
I think this depends on how builds are done using CLI |
@shilman I recommend tagging this as a bug or feature request. A new angular project with scss will result in this error. I don't think it's a question. To reproduce:
I would expect the default installation to work. Instead a user would need to find this bug report and then downgrade their Angular version. |
Same issue HERE 😿 |
Hi there, I can report that I'm experiencing the same problem. The I've also had to create an empty default project of type |
Hey, I can reproduce the issue as well. I do not know the behind-the-scene Angular compiler though, so I do not know if it is perfectly fine or if the issue may be related to this. @builtbyjay I had the same issue as well, when the first project is a library, I got the same webpack config warning. I think the solution is to create a project named |
Does anyone have a work around that involves just editing angular.json instead of downgrading Angular CLI? I'd like to get the faster differential builds that 8.3 has. I already have a customized angular.json with a storybook project but it still suffers from this issue. |
@bufke afaik, there is no way, if you want to build on the same workspace (and thus on the same NPM modules). |
So...no way other then to downgrade angular CLI version? |
I got it working in a library only workspace using the following in .storybook/webpack.config.js
To fix the angular-cli webpack config warning you need to add
to angular.json in the build options. |
hope this will be fix soon |
@Anthbs trying to use your configuration but getting
My options are just like yours tho:
any idea? |
I think its cause your file is empty? |
Yes, saw this one as well. I'm not adding any rules myself but I see there are these two:
and
and yes they have incorrect options according to the error I'm getting I see this is coming from my angular.json which is picked up by storybook. Can I tell storybook which build configuration to use? |
How did you make this work? |
@shilman Could you give an indication on when this could be fixed? It has been high priority for 23 days now. Having an indication on when it could be fixed could help us determine when to upgrade to the latest version. |
I'm also curious if this can be fixed in a way that ensures it won't break again in the future. It's troubling that a CLI release without any breaking changes would cause problems like this. Does this project use unsupported/private functionality of Angular CLI? |
@literalpie Storybook hooks into the configuration of Angular in order to provide a zero-configuration environment. While in theory this sounds amazing it actually is troublesome if Angular changes their way of handling webpack stuff. Also troublesome are webpack dependencies that are shared between Angular and Storybook (or possibly installed twice due to version mismatch) Regarding the webpack stuff: I might have a possible improvement to future changes of Angular CLI but it's still just an idea. Possible workaroundFor running the latest Angular + Storybook version please try to What's going on?
The angular app itself seems to work with Still an assumption: So far so good, I hope the workaround is working for everyone who has trouble right now 🤞 |
I think breaking changes must happen if it's necessary sir. Hope more good new from you and StorybookJS team. |
@kroeder thanks! If someone has the time to try this out with v9 BETA, please let us all know if it works too. |
According to webpack-contrib/raw-loader#79 this seems to be a general issue, not only a Storybook specific issue I also found several other issues in other repositories. Although a lot of people saying "use 1.0.0 in order to fix this" I will first check if we can use the latest version or at least raw-loader 2.0.0 |
@kroeder thanks a lot for your effort, on Sundays too. We appreciate it. |
My workaround was to patch You can achieve the same by installing patch-package, adding a diff --git a/node_modules/angular2-template-loader/index.js b/node_modules/angular2-template-loader/index.js
index 587cf75..f26754b 100644
--- a/node_modules/angular2-template-loader/index.js
+++ b/node_modules/angular2-template-loader/index.js
@@ -11,6 +11,6 @@ function replaceStringsWithRequires(string) {
if (url.charAt(0) !== ".") {
url = "./" + url;
}
- return "require('" + url + "')";
+ return "require('" + url + "').default";
});
} |
@urish that's some nice trickery here. Gonna try that too. Thanks. |
@urish thanks for sharing this! I contacted the owner of |
@kroeder happy to help :-) If you want the workaround to be backward compatible with the older return "(require('" + url + "').default||require('" + url + "'))"; |
Ooh-la-la!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.3.0-alpha.18 containing PR #8269 that references this issue. Upgrade today to try it out! You can find this prerelease on the Closing this issue. Please re-open if you think there's still more to do. |
Good golly!! I just released https://github.com/storybookjs/storybook/releases/tag/v5.2.4 containing PR #8269 that references this issue. Upgrade today to try it out! |
@shamin seems working on 5.2.4 ;) Thanks! |
Describe the bug
Components with SCSS or LESS (probably others too)
styleUrls
don’t load in Storybook. The following error message is printed to the console:The referenced stylesheet seems to be loaded as a module, where it should actually be a string (see screenshot below).
To Reproduce
Steps to reproduce the behavior:
ng new test-app
npx -p @storybook/cli@next sb init
stories/Welcome.stories.ts
, useAppComponent
instead ofWelcome
as thecomponent
Expected behavior
The components should successfully show.
Screenshots
Code snippets
N/A
System:
Additional context
This seems to be a reincarnation of #3593. The workarounds from this issue did not work for me.
The text was updated successfully, but these errors were encountered: