misskey/packages/frontend/.storybook/main.ts
Acid Chicken (硫酸鶏) 47c7b4b9cc
fix(#10609): remove isChromatic on real build (#10613)
* perf: remove isChromatic on real build

* revert: Revert #10475 in MkTime

This reverts commit 7d11cf8ec9.

* @rollup/plugin-replace as dependencies

* fix pnpm-lock,yaml

---------

Co-authored-by: tamaina <tamaina@hotmail.co.jp>
2023-04-13 23:23:11 +09:00

45 lines
1.2 KiB
TypeScript

import { resolve } from 'node:path';
import type { StorybookConfig } from '@storybook/vue3-vite';
import { type Plugin, mergeConfig } from 'vite';
import turbosnap from 'vite-plugin-turbosnap';
const config = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|ts|tsx)'],
addons: [
'@storybook/addon-essentials',
'@storybook/addon-interactions',
'@storybook/addon-links',
'@storybook/addon-storysource',
resolve(__dirname, '../node_modules/storybook-addon-misskey-theme'),
],
framework: {
name: '@storybook/vue3-vite',
options: {},
},
docs: {
autodocs: 'tag',
},
core: {
disableTelemetry: true,
},
async viteFinal(config) {
const replacePluginForIsChromatic = config.plugins?.findIndex((plugin) => plugin && (plugin as Partial<Plugin>)?.name === 'replace') ?? -1;
if (~replacePluginForIsChromatic) {
config.plugins?.splice(replacePluginForIsChromatic, 1);
}
return mergeConfig(config, {
plugins: [
turbosnap({
rootDir: config.root ?? process.cwd(),
}),
],
build: {
target: [
'chrome108',
'firefox109',
'safari16',
],
},
});
},
} satisfies StorybookConfig;
export default config;