import type { StorybookConfig } from "@storybook/vue3-vite"
import { fileURLToPath, URL } from "node:url"

const config: StorybookConfig = {
  stories: ["../src/**/*.stories.@(ts|tsx)"],

  addons: [
    "@storybook/addon-docs",
    "@storybook/addon-a11y",
    "@storybook/addon-themes",
  ],

  framework: {
    name: "@storybook/vue3-vite",
    options: {},
  },

  viteFinal: async (config) => {
    config.resolve = config.resolve ?? {}
    config.resolve.alias = {
      ...(config.resolve.alias as Record<string, string>),
      "@": fileURLToPath(new URL("../src", import.meta.url)),
    }
    return config
  }
}

export default config
