AFFiNE/packages/component/.storybook/vite.config.ts

34 lines
1005 B
TypeScript
Raw Normal View History

2023-02-14 06:18:43 +03:00
import type { StorybookConfig } from '@storybook/react-vite';
import { mergeConfig } from 'vite';
2023-03-25 06:25:27 +03:00
import { resolve } from 'node:path';
2023-02-14 06:18:43 +03:00
import { fileURLToPath } from 'url';
2023-03-25 06:25:27 +03:00
import istanbul from 'vite-plugin-istanbul';
2023-02-14 06:18:43 +03:00
const config: Pick<StorybookConfig, 'viteFinal'> = {
async viteFinal(config, { configType }) {
return mergeConfig(config, {
2023-03-25 06:25:27 +03:00
plugins: [
istanbul({
include: ['src/*'],
exclude: ['node_modules', 'test', 'stories'],
extension: ['.ts', '.tsx'],
forceBuildInstrument: process.env.COVERAGE === 'true',
}),
],
2023-02-14 06:18:43 +03:00
resolve: {
alias: {
2023-03-25 06:25:27 +03:00
'@': resolve(fileURLToPath(new URL('../src', import.meta.url))),
'@affine/component': resolve(
fileURLToPath(new URL('../src/index.ts', import.meta.url))
),
2023-03-25 06:25:27 +03:00
'@affine/i18n': resolve(
2023-02-14 06:18:43 +03:00
fileURLToPath(new URL('../../i18n/src', import.meta.url))
),
},
},
});
},
};
export default config;