@storybook/angular WebPackConfigOptions is relying on hardcoded `build` target
See original GitHub issueDescribe the bug
Currently, the @storybook/angular
plugin is relying hardcoded on the build
target from the Angular Architect. This is a problem as it wants to collect the tsConfig information from the build target.
https://github.com/storybookjs/storybook/blob/next/app/angular/src/server/angular-cli_config.ts#L100
// https://github.com/storybookjs/storybook/blob/next/app/angular/src/server/angular-cli_config.ts#L100
const { options: projectOptions } = project.architect.build;
const normalizedAssets = normalizeAssetPatterns(
projectOptions.assets,
dirToSearch,
project.sourceRoot
);
const projectRoot = path.resolve(dirToSearch, project.root);
const tsConfigPath = path.resolve(dirToSearch, projectOptions.tsConfig) as Path;
You can not rely on the project options of the hardcoded build target to get the tsConfig as this will result in not finding a tsConfig if you have a build target that has not a tsConfig field.
As you can have a different builder for the architect build step for example:
"architect": {
"build": {
"builder": "@nrwl/workspace:run-commands",
"options": {
"parallel": true,
"commands": [
{
"command": "npx ng run my-app:build-frontend"
},
{
"command": "npx ng run my-app:build-server"
}
]
},
I want to specify storybook which target it should take in this case myapp:build-frontend
to get the tsConfig options out of it. Otherwise, it will result in the following Error:
[error] TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
at validateString (internal/validators.js:117:11)
at Object.resolve (path.js:980:7)
at Object.getAngularCliWebpackConfigOptions (/.../node_modules/@storybook/angular/dist/server/angular-cli_config.js:99:39)
at Object.webpackFinal (/.../node_modules/@storybook/angular/dist/server/framework-preset-angular-cli.js:7:56)
at /.../node_modules/@storybook/core/dist/server/presets.js:261:72
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:16 (5 by maintainers)
So If you want to implement this approach I could help you with that, as it is my daily job, creating angular builders and setup for https://github.com/Dynatrace/barista 😂
@kroeder @lukasholzer this sounds reasonable to me!