0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-11-25 02:49:32 +01:00
posthog/.storybook/main.js
Marius Andra c271eb99a5
feat(storybook): cleanup volume 1 (#9033)
* rearrange stories

* fix bug in storybook with mock data

* convert to TS, fix static path deprecation

* wrap all scenes with KeaStory, deprecate getReduxState

* remove old text

* don't complain about postcss

* remove ApiSelector, revert to ".js" main

* preview ".ts"

* fix msw

* move kea story

* fix urls

* add /decide handler

* mount logics that are there on app

* reduce boilerplate

* refactor history list storybook api

* separate data
2022-03-15 17:36:51 +01:00

47 lines
1.4 KiB
JavaScript

const { createEntry } = require('../webpack.config')
const babelConfig = require('../babel.config')
module.exports = {
stories: ['../frontend/src/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
{
name: 'storybook-addon-turbo-build',
options: {
optimizationLevel: 3,
},
},
],
staticDirs: ['public'],
babel: async () => {
// 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')
return {
...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')),
],
},
}
},
features: {
postcss: false,
},
}