/** @type { import('@storybook/react-vite').StorybookConfig } */
const config = {
  stories: [
    '../stories/**/*.mdx',
    '../stories/**/*.stories.@(js|jsx|mjs|ts|tsx)', //

    '../packages/**/*.mdx',
    '../packages/**/*.stories.@(js|jsx|mjs|ts|tsx)',
  ],
  addons: ['@storybook/addon-essentials', '@storybook/addon-onboarding', '@chromatic-com/storybook', '@storybook/experimental-addon-test'],
  framework: {
    name: '@storybook/react-vite',
    options: {},
  },
  async viteFinal(config) {
    const isDev = config.mode === 'development';
    config.base = isDev ? '/' : '/root/tw-story'; // 设置基础路径
    // 添加 Tailwind CSS 支持
    config.css = {
      postcss: {
        // @ts-ignore
        plugins: [require('@tailwindcss/postcss')({})],
      },
    };
    return config;
  },
};
export default config;
