2023-02-03 13:06:21 +01:00
|
|
|
import { createEntry } from '../webpack.config'
|
2023-08-21 09:32:49 +02:00
|
|
|
import { StorybookConfig } from '@storybook/react-webpack5'
|
2021-08-25 10:38:33 +02:00
|
|
|
|
2023-02-03 13:06:21 +01:00
|
|
|
const config: StorybookConfig = {
|
2021-09-07 14:00:44 +02:00
|
|
|
stories: ['../frontend/src/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
|
2023-08-21 09:32:49 +02:00
|
|
|
|
2022-03-08 14:17:59 +01:00
|
|
|
addons: [
|
2023-08-21 09:32:49 +02:00
|
|
|
'@storybook/addon-docs',
|
2022-03-08 14:17:59 +01:00
|
|
|
'@storybook/addon-links',
|
|
|
|
'@storybook/addon-essentials',
|
2022-03-17 08:45:47 +01:00
|
|
|
'@storybook/addon-storysource',
|
2022-12-12 10:28:06 +01:00
|
|
|
'@storybook/addon-a11y',
|
|
|
|
'storybook-addon-pseudo-states',
|
2022-03-08 14:17:59 +01:00
|
|
|
],
|
2023-08-21 09:32:49 +02:00
|
|
|
|
2022-03-15 17:36:51 +01:00
|
|
|
staticDirs: ['public'],
|
2023-08-21 09:32:49 +02:00
|
|
|
|
2021-08-25 10:38:33 +02:00
|
|
|
webpackFinal: (config) => {
|
|
|
|
const mainConfig = createEntry('main')
|
2022-03-15 17:36:51 +01:00
|
|
|
return {
|
2021-08-25 10:38:33 +02:00
|
|
|
...config,
|
|
|
|
resolve: {
|
|
|
|
...config.resolve,
|
2023-02-03 13:06:21 +01:00
|
|
|
extensions: [...config.resolve!.extensions!, ...mainConfig.resolve.extensions],
|
|
|
|
alias: { ...config.resolve!.alias, ...mainConfig.resolve.alias },
|
2021-08-25 10:38:33 +02:00
|
|
|
},
|
|
|
|
module: {
|
|
|
|
...config.module,
|
|
|
|
rules: [
|
|
|
|
...mainConfig.module.rules,
|
2023-08-21 09:32:49 +02:00
|
|
|
...(config.module?.rules?.filter(
|
|
|
|
(rule: any) => 'test' in rule && rule.test.toString().includes('.mdx')
|
|
|
|
) ?? []),
|
2021-08-25 10:38:33 +02:00
|
|
|
],
|
|
|
|
},
|
|
|
|
}
|
2022-03-15 17:36:51 +01:00
|
|
|
},
|
2023-08-21 09:32:49 +02:00
|
|
|
|
|
|
|
framework: {
|
|
|
|
name: '@storybook/react-webpack5',
|
2024-01-16 20:43:15 +01:00
|
|
|
options: { builder: { useSWC: true } }
|
2023-08-21 09:32:49 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
docs: {
|
|
|
|
autodocs: 'tag',
|
2021-08-25 10:38:33 +02:00
|
|
|
},
|
2023-12-11 13:26:49 +01:00
|
|
|
|
|
|
|
typescript: { reactDocgen: 'react-docgen' }, // Shouldn't be needed in Storybook 8
|
2021-08-25 10:38:33 +02:00
|
|
|
}
|
2023-02-03 13:06:21 +01:00
|
|
|
|
|
|
|
export default config
|