import type { StorybookConfig } from 'storybook-solidjs-vite';
import { fileURLToPath } from 'node:url';
import path from 'node:path';
import tailwindcss from '@tailwindcss/vite';

const config: StorybookConfig = {
  "stories": [
    "../src/**/*.mdx",
    "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"
  ],
  "addons": [
    "@storybook/addon-a11y",
    "@storybook/addon-docs"
  ],
  "framework": "storybook-solidjs-vite",
  async viteFinal(viteConfig) {
    return {
      ...viteConfig,
      plugins: [...(viteConfig.plugins || []), tailwindcss()],
      resolve: {
        ...(viteConfig.resolve || {}),
        alias: {
          ...((viteConfig.resolve && viteConfig.resolve.alias) || {}),
          '~': path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../src'),
        },
      },
    };
  },
};
export default config;
