2026-01-05 14:43:19 +03:00
|
|
|
import type { StorybookConfig } from '@storybook/svelte-vite';
|
2026-01-18 19:24:11 +03:00
|
|
|
import {
|
|
|
|
|
dirname,
|
|
|
|
|
resolve,
|
|
|
|
|
} from 'path';
|
|
|
|
|
import { fileURLToPath } from 'url';
|
|
|
|
|
import {
|
|
|
|
|
loadConfigFromFile,
|
|
|
|
|
mergeConfig,
|
|
|
|
|
} from 'vite';
|
|
|
|
|
|
|
|
|
|
const __filename = fileURLToPath(import.meta.url);
|
|
|
|
|
const __dirname = dirname(__filename);
|
2026-01-05 14:43:19 +03:00
|
|
|
|
|
|
|
|
const config: StorybookConfig = {
|
|
|
|
|
'stories': [
|
|
|
|
|
'../src/**/*.mdx',
|
|
|
|
|
'../src/**/*.stories.@(js|ts|svelte)',
|
|
|
|
|
],
|
|
|
|
|
'addons': [
|
|
|
|
|
{
|
|
|
|
|
name: '@storybook/addon-svelte-csf',
|
|
|
|
|
options: {
|
|
|
|
|
legacyTemplate: true, // Enables the legacy template syntax
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
'@chromatic-com/storybook',
|
|
|
|
|
'@storybook/addon-vitest',
|
|
|
|
|
'@storybook/addon-a11y',
|
|
|
|
|
'@storybook/addon-docs',
|
|
|
|
|
],
|
|
|
|
|
'framework': '@storybook/svelte-vite',
|
2026-01-18 19:24:11 +03:00
|
|
|
async viteFinal(config) {
|
|
|
|
|
// This attempts to find your actual vite.config.ts
|
|
|
|
|
const { config: userConfig } = await loadConfigFromFile(
|
|
|
|
|
{ command: 'serve', mode: 'development' },
|
|
|
|
|
resolve(__dirname, '../vite.config.ts'),
|
|
|
|
|
) || {};
|
|
|
|
|
|
|
|
|
|
return mergeConfig(config, {
|
|
|
|
|
// Merge only the resolve/alias parts if you want to be safe
|
|
|
|
|
resolve: userConfig?.resolve || {},
|
|
|
|
|
});
|
|
|
|
|
},
|
2026-01-05 14:43:19 +03:00
|
|
|
};
|
|
|
|
|
export default config;
|