I'm new in the world of angular, nx and storybook. I've been googling for quite a while and reading through several threads, but so far nothing has been able to help me.
I have a single Angular app with some libs. I only want one Storybook instance, which contains all the stories of the Libs. But I get the message "container.components.stories.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property"
Here are some info:
- My directory structure looks like this (see picture.
.storybook
main.js
tsconfig.json
apps
myproject
.storybook
src
tsconfig.json
tsconfig.app.json
libs
ui
common
src
lib
container
container.component.ts
container.component.spec.ts
container.component.stories.ts
container.component.scss
container.component.html
- nx report
Node : 16.13.1
OS : win32 x64
npm : 8.4.1
nx : 14.0.3
@nrwl/angular : 14.0.3
@nrwl/cypress : 14.0.3
@nrwl/detox : Not Found
@nrwl/devkit : 14.0.3
@nrwl/eslint-plugin-nx : 14.0.3
@nrwl/express : Not Found
@nrwl/jest : 14.0.3
@nrwl/js : Not Found
@nrwl/linter : 14.0.3
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : Not Found
@nrwl/nx-cloud : Not Found
@nrwl/nx-plugin : Not Found
@nrwl/react : Not Found
@nrwl/react-native : Not Found
@nrwl/schematics : Not Found
@nrwl/storybook : 14.0.3
@nrwl/web : Not Found
@nrwl/workspace : 14.0.3
typescript : 4.6.3
rxjs : 7.4.0
---------------------------------------
Community plugins:
@twittwer/compodoc: 1.7.0
@compodoc/compodoc: 1.1.19
@storybook/angular: 6.4.22
- .storybook/main.js
module.exports = {
stories: ['../../../libs/**/*.stories.ts'],
addons: ['@storybook/addon-essentials'],
// uncomment the property below if you want to apply some webpack config globally
// webpackFinal: async (config, { configType }) => {
// // Make whatever fine-grained changes you need that should apply to all storybook configs
// // Return the altered config
// return config;
// },
};
- .storybook/tsconfig.json
{
"extends": "../tsconfig.base.json",
"exclude": ["../**/*.spec.js", "../**/*.test.js", "../**/*.spec.ts", "../**/*.test.ts", "../**/*.spec.tsx", "../**/*.test.tsx", "../**/*.spec.jsx", "../**/*.test.jsx"],
"include": ["../**/*", "../../../libs/**/*"]
}
- apps/myproject/.storybook/main.js
const rootMain = require('../../../.storybook/main');
module.exports = {
...rootMain,
core: { ...rootMain.core, builder: 'webpack5' },
stories: [...rootMain.stories, '../src/app/**/*.stories.mdx', '../src/app/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [...rootMain.addons],
webpackFinal: async (config, { configType }) => {
// apply any global webpack configs that might have been specified in .storybook/main.js
if (rootMain.webpackFinal) {
config = await rootMain.webpackFinal(config, { configType });
}
// add your own webpack tweaks if needed
return config;
},
};
I have the following questions:
- What do I have to do so that Storybook processes all stories from apps and libs?
- Why I need webpack in my package.json? When I first tried to install Storybook, no webpack module had been added. I want to avoid adding unnecessary modules.