1
1
const svgoConfig = require ( '../common/config/svgo' ) ;
2
+ import type { StorybookConfig } from '@storybook/nextjs' ;
2
3
3
- const config = {
4
- stories : [ '../components/**/__stories__/*.stories.js' ] ,
4
+ const config : StorybookConfig = {
5
+ stories : [
6
+ '../components/**/__stories__/*.mdx' ,
7
+ '../components/**/__stories__/*.stories.@(js|jsx|mjs|ts|tsx)' ,
8
+ ] ,
5
9
staticDirs : [ '../public' ] ,
6
10
addons : [
7
11
'@storybook/addon-essentials' ,
@@ -13,7 +17,9 @@ const config = {
13
17
] ,
14
18
webpackFinal : async config => {
15
19
// Find the Storybook Webpack rule relevant to SVG files.
20
+ // @ts -expect-error => 'config.module' is possibly 'undefined'.ts(18048)
16
21
const imageRule = config . module . rules . find ( rule => {
22
+ // @ts -expect-error => 'rule' is possibly 'null' or 'undefined'.ts(18049)
17
23
if ( rule . test && rule . test . test ( '.svg' ) ) {
18
24
console . log ( { rule } ) ;
19
25
return true ;
@@ -23,9 +29,11 @@ const config = {
23
29
} ) ;
24
30
25
31
// Ignore what Storybook does
32
+ // @ts -expect-error => 'imageRule' is possibly 'null' or 'undefined'.ts(18049)
26
33
imageRule . exclude = / \. s v g $ / ;
27
34
28
35
// Configure .svg files to be loaded with @svgr /webpack
36
+ // @ts -expect-error => 'config.module' is possibly 'undefined'.ts(18048)
29
37
config . module . rules . push ( {
30
38
test : / \. s v g $ / ,
31
39
use : [
0 commit comments