2021-08-25 10:38:33 +02:00
|
|
|
const { createEntry } = require('../webpack.config')
|
|
|
|
const babelConfig = require('../babel.config')
|
|
|
|
|
|
|
|
module.exports = {
|
2021-09-07 14:00:44 +02:00
|
|
|
stories: ['../frontend/src/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
|
2022-03-08 14:17:59 +01:00
|
|
|
addons: [
|
2022-03-17 08:45:47 +01:00
|
|
|
{
|
|
|
|
name: '@storybook/addon-docs',
|
|
|
|
options: {
|
|
|
|
sourceLoaderOptions: {
|
|
|
|
injectStoryParameters: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
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
|
|
|
],
|
2022-03-15 17:36:51 +01:00
|
|
|
staticDirs: ['public'],
|
|
|
|
babel: async () => {
|
2021-08-25 10:38:33 +02:00
|
|
|
// compile babel to "defaults" target (ES5)
|
|
|
|
const envPreset = babelConfig.presets.find(
|
|
|
|
(preset) => Array.isArray(preset) && preset[0] === '@babel/preset-env'
|
|
|
|
)
|
|
|
|
envPreset[1].targets = 'defaults'
|
|
|
|
return babelConfig
|
|
|
|
},
|
|
|
|
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,
|
|
|
|
extensions: [...config.resolve.extensions, ...mainConfig.resolve.extensions],
|
|
|
|
alias: { ...config.resolve.alias, ...mainConfig.resolve.alias },
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
...config.module,
|
|
|
|
rules: [
|
|
|
|
...mainConfig.module.rules,
|
|
|
|
...config.module.rules.filter((rule) => rule.test.toString().includes('.mdx')),
|
2022-03-17 08:45:47 +01:00
|
|
|
{
|
|
|
|
test: /\.stories\.tsx?$/,
|
|
|
|
use: [
|
|
|
|
{
|
|
|
|
loader: require.resolve('@storybook/source-loader'),
|
|
|
|
options: { parser: 'typescript' },
|
|
|
|
},
|
|
|
|
],
|
|
|
|
enforce: 'pre',
|
|
|
|
},
|
2021-08-25 10:38:33 +02:00
|
|
|
],
|
|
|
|
},
|
|
|
|
}
|
2022-03-15 17:36:51 +01:00
|
|
|
},
|
|
|
|
features: {
|
|
|
|
postcss: false,
|
2021-08-25 10:38:33 +02:00
|
|
|
},
|
|
|
|
}
|