Describe the bug
Tsconfig file path, using by storybook/angular TsconfigPathsPlugin here, is
.storybook/tsconfig.jsonconsole.log of cliWebpackConfigOptions.buildOptions.tsConfig shows
projects/app1/tsconfig.json
despite we're running storybook for app2 and have a projects/app2/.storybook/tsconfig.json file
To Reproduce
Steps to reproduce the behavior:
yarn installyarn start-storybook -c projects/app2/.storybookERROR in ./projects/app2/src/app/app.component.ts
Module not found: Error: Can't resolve '@app2/test-module/const' in 'D:\projects\tests\storybook-tsconfigpaths\projects\app2\src\app'
@ ./projects/app2/src/app/app.component.ts 3:0-53 6:21-31
yarn start-storybook -c projects/app2/.storybookExpected behavior
Proper tsconfig path resoltion that respects .storybook/tsconfig.json existing
@storybook/angular@^5.2.5
As @artaommahe well said, until now, when starting SB ts-loader uses tsconfig.json from SB config folder and TsconfigPathsPlugin webpack plugin is using tsconfig.json related to the main project of angular.json file.
I made a commit on a branch to use tsconfig.json from SB config folder if it has one tsconfig.json (and it should) and fallback to angular.json related one if it doesn't https://github.com/storybookjs/storybook/commit/686422787c9b397872fee86b5f7e986fe2b9c06c
As we are not using the same tsconfig.json file as before, TS compiler throws new errors and I don't know how to fix them for now.
An other interesting point is that we are continuing to use loaders from projects of angular.json file for styles and CLI related, it's done with @angular-devkit/build-angular here: inhttps://github.com/storybookjs/storybook/blob/b84559e40dc063d06041ccbccb78554e9ca8a5bc/app/angular/src/server/angular-cli_config.js#L109
@kroeder @ndelangen can you take a look at my commit and tell me if it's ok to do something like I did and if you have any idea about the direction we should follow about SB x Angular with multiple (sub) projects?
This is too deep into ts + angular land for me to make a judgement on I'm afraid. I'd trust @kroeder's expertise.
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!
nope :/
Bump
Looks like it might be caused by this line: https://github.com/storybookjs/storybook/blob/2ebcb6c41b23e6f09b6b9db96bfcb38ca30a83ca/app/angular/src/server/angular-cli_config.ts#L73
Is relying on the Angular.json architect build value for ts config and never searches the .storybook directory as an option