AFFiNE/packages/component/.storybook/main.ts

48 lines
1.3 KiB
TypeScript
Raw Normal View History

2023-02-14 06:18:43 +03:00
import type { StorybookConfig } from '@storybook/react-vite';
import { fileURLToPath } from 'node:url';
import { mergeConfig } from 'vite';
2023-04-04 02:13:43 +03:00
import tsconfigPaths from 'vite-tsconfig-paths';
import { vanillaExtractPlugin } from '@vanilla-extract/vite-plugin';
2023-02-14 06:18:43 +03:00
export default {
stories: ['../src/**/*.stories.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
staticDirs: ['../../../apps/web/public'],
2023-03-11 08:15:19 +03:00
addons: [
'@storybook/addon-links',
'@storybook/addon-essentials',
2023-03-11 08:15:19 +03:00
'@storybook/addon-interactions',
'@storybook/addon-storysource',
'@storybook/addon-coverage',
'storybook-dark-mode',
2023-03-11 08:15:19 +03:00
],
2023-02-14 06:18:43 +03:00
framework: {
name: '@storybook/react-vite',
},
async viteFinal(config, { configType }) {
return mergeConfig(config, {
2023-04-04 02:13:43 +03:00
plugins: [
vanillaExtractPlugin(),
2023-04-04 02:13:43 +03:00
tsconfigPaths({
root: fileURLToPath(new URL('../../../', import.meta.url)),
}),
],
define: {
'process.env': {},
},
resolve: {
alias: {
2023-04-25 06:33:09 +03:00
'dotenv/config': fileURLToPath(
new URL('../../../scripts/vitest/dotenv-config.ts', import.meta.url)
),
'next/config': fileURLToPath(
new URL(
'../../../scripts/vitest/next-config-mock.ts',
import.meta.url
)
),
},
2023-02-14 06:18:43 +03:00
},
});
2023-02-14 06:18:43 +03:00
},
} as StorybookConfig;