-
-
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
angular 13.1 stories file missing from the TypeScript compilation #17039
Comments
Changing the default includes in
to
solved the above issue for me. Not sure though if this is only a workaround. |
I should clarify that this isn't a problem in angular 13.0. So even if it expected that the stories need to be included, it may be an unintentional breaking change since this wasn't required in the past. |
Simple step to reproduce with angular 13.1:
In my case change |
I think the best workaround is probably to add a storybook builder to angular.json |
@literalpie any other solutions? we have storybooks for a group of libs, dunno how it will work in angular.json to add builder for such case |
I got this to "build" by removing
However, then I am faced with JIT issues such as Also I get this when downgrading to Angular 13.0.3. not just 13.1.x. |
@artaommahe I think using a builder in the angular.json file should still work. You can see an example in a different branch of my reproduction project here. Notice that the storybook builder is not a part of any specific Angular project. @danielbater I wouldn't recommend including all files using a wildcard like you did in the tsconfig. I think this will probably cause a lot of issues. Was your project working at a different point (for example, when you were on 12.x), or is this a new project? The issue you are seeing might be unrelated to mine. |
Thanks @literalpie , I have switched our project using builder on angular.json file but the watch feature and build during editing doesn't work anymore, have you tested on your side? |
@literalpie I agree including everything is not a good idea, but only way I could get this to work. Yes project works fine when using Angular 12. When remaining in Angular 13 and I go back to a normal setup which for me is no tsconfig in The error is the same as yours.
So I tried adding includes to my I added a fresh new
But then continue to get cannot find stories.
|
I have just tried the above adding to angular.json build, this does build but also has JIT issues I see when adding wildcard to
I have obviously checked this, and it's not an issue. Also the actual Angular app builds/runs fine no JIT issues, and I get lots of these for every single story/component. and another JIT issue:
The latter I think is linked to Zeplin addon |
I'm getting the same JIT errors as @danielbater since the update to Angular 13.1 and Storybook 6.5.0-alpha.4 (also 6.4.9)
This is happening for all 35 components in a library There were no errors with Angular 12 & Storybook 6.3 It happens when building either with |
It would be helpful if someone could link to a repo/branch that gets the JIT error, or instructions on how to change my repro to get the error. |
Thanks @literalpie ... just run:
secondly, watch files doesn't work anymore with angular.json as described: #17039 (comment) |
@literalpie using @meriturva's steps you should see the error when running
If you update angular.json following here, and working through a few issues like
And run command Following on from this I wanted to create the simplist repo (here) with issue and seems once I added Angular Material is when it happened.
Hope this helps. I did have a few more examples in repo hoping to find a simplier way to demo the issue, but these only show the issue above where they do not look how I would expect. |
I am having the same issue with missing styles. Has anyone found a workaround? |
We actually have the same issue in our app and figured out that the problem comes from loading template files via templateUrl. If we have our template inline in the .ts file then storybook renders it properly but if we extract it to a different template (html) file and use it via templateUrl then rendering breaks with the JIT compilation error. |
As @markos-ag points out, inlining the template solves the JIT error for me too. |
I think this needs to be solved. It's not a robust solution to inline all the templates. Good work on finding the issue though! |
Agree with @ankor-at-ccmath this needs a fix. I have updated my repo with a new branch containing with a new component |
I was facing the same issue here, and what I did was comment out this lines from
after that I get this error: then I solved adding I hope I can help someone with this solution, and please let me know if this solution is not the best 😊 |
I have not tested this but is interesting, should the |
@danielbater Thanks for the repo: https://github.com/danielbater/storybook-a13-issue/tree/inline-template , i'm testing right now and I have found the same issue regarding also our project, what about the files watch feature? I mean, no recompile is run when file changes. is it the same on your side? |
Good golly!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.5.0-alpha.10 containing PR #17131 that references this issue. Upgrade today to the
Closing this issue. Please re-open if you think there's still more to do. |
@shilman is it possible to push this fix to 6.4? According to Storybook roadmap, 6.5 is expected only in March, such a long wait... I think everyone would appreciate if we could enjoy this fix without upgrading to unstable alpha version. |
@KirillMetrik absolutely. If somebody can verify the fix with the alpha, I'll patch it back to the stable release |
@shilman I'll test it now. Tested JIT error and live-reload and everything seems to work 👌 |
@shilman I have just updated to version |
@rosostolato do you have a reproduction or any information you can share to help narrow it down? |
@shilman I'm trying to create a new repo to reproduce it. In the meatime, I can share the logs:
storybook main.js: module.exports = {
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'storybook-dark-mode',
'@storybook/addon-knobs',
'@storybook/addon-links',
'@storybook/addon-backgrounds',
'@storybook/addon-storysource',
{
name: '@storybook/addon-essentials',
options: {
controls: false,
},
},
],
core: {
builder: 'webpack5',
},
}; tsconfig.json: {
"extends": "../tsconfig.app.json",
"compilerOptions": {
"types": [
"node",
"@types/resize-observer-browser"
],
"typeRoots": [
"node_modules/@types"
]
},
"exclude": [
"../src/test.ts",
"../src/**/*.spec.ts",
"../src/**/*.worker.ts",
"../projects/**/*.spec.ts"
],
"include": [
"../src/**/*",
"../projects/**/*"
],
"files": [
"./typings.d.ts"
]
} I'm running on node v12.21.0 (npm v6.14.11) |
@shilman I reproduced it on a brand new project and I got the same error. Just need to run these steps above. Tested on node v12.21.0 (npm v6.14.11)... I'm updating the node version and will try again. No luck. Here is the new app log running on node v17.3.0 (npm v8.3.0)
|
Great Caesar's ghost!! I just released https://github.com/storybookjs/storybook/releases/tag/v6.4.10 containing PR #17131 that references this issue. Upgrade today to the
|
It looks like only #17131 is included but #17032 is missing so that build step already fails. Would it be possible to release that fix in 6.4.x as well? |
looks like too much broken stuff 😕 |
I don't really understand why this issue is closed.. It is still broken for us on Angular 13.1 and storybook version 6.4.12. |
I can confirm there are some of these issues still happening.
Running the app via ng serve compiles and loads successfully. |
Quick confirmation that these issues are still happening when using Angular 13.2.24 and Storybook 6.4.19. Both are the latest releases as of now. There's no storybook:build configuration present within angular.json. I was hoping this would be configured automatically, but alas, |
try the following in
|
I did, but including the stories in the TSConfig caused other problems for me. At least, I assume they have to do with that step. I'm currently implementing a lot of Angular custom form controls. The moment I change or touch an element in the preview iframe of Storybook, these errors keep popping up. So it's hard to see if the component actually works as intended. |
well, now that's out of the way. you can work on fixing this... did they work OK before?. it would be great if you could share your strories source code here |
Thanks Fasid! But I'm not sure if including the /stories/ directory inside tsconfig.json is the solution. I think it'll only generate more unnecessary type errors. But I'm just guessing at this point :). Here's the code of one of my stories
Oh and Im not sure if they ever worked before :). I got these errors right from the start. |
Not just |
I know :). And that's the one I included the directory in. Not the root tsconfig. |
here is my config. (i'm using Nx though).
storybook versions
|
Thanks! This is the contents of my angular.json. Please note that all my errors are Reactive Forms related though. But perhaps something can be improved here?
|
do a version bump of storybook-related packages to |
Thanks. I'd need more info on the rest of your angular.json file though. And how much it differs from mine. |
Also, I think my problem has more to do with the way including the Reactive Forms module causes more type errors in the Storybook preview iframe. I'm not sure how to tackle that. |
@fasidOnGit Hi Fasid, thanks for thinking along! I found the cause and it is.. quite random. Please check this comment: #14627 (comment) . Turns out the spread operator used to insert the agrs was the cause of all the issues. I had to rewrite code like this:
It is a very random solution and I'm quite surprised the spread operator can't be used this way. |
@nzacca None of the solutions in this thread have worked for me. Is there any package update or solution available to resolve this? Here are my package.json and storybook/main.js for reference: package.json- Main.js Any help would be appreciated |
Describe the bug
When using Angular 13.1, the latest storybook, and no "storybook:build" builder, I get the following error:
To Reproduce
Create a new project with Angular 13.1 and the latest storybook alpha (stable does not support ng 13.1). Make sure you don't have a "storybook:build" configuration in your angular.json file. Try building.
see this reproduction
System
Additional context
The text was updated successfully, but these errors were encountered: