const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
const Path = require('path');

const AppSourceDir = Path.join(__dirname, '..', 'src');


module.exports = {
  stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
  addons: [
    "@storybook/addon-links",
    "@storybook/addon-essentials",
    "@storybook/addon-interactions",
    "@storybook/preset-create-react-app",
    "storybook-addon-pseudo-states",
  ],
  framework: "@storybook/react",
  core: {
    builder: "@storybook/builder-webpack5",
  },
  webpackFinal: async (config, { configType }) => {
    config.resolve.plugins = [
      ...(config.resolve.plugins || []),
      new TsconfigPathsPlugin({
        extensions: config.resolve.extensions,
      }),
    ];
    config.resolve.alias["@assets"] = Path.resolve(__dirname, '..', 'src', 'assets')
    console.log(config);
    return config;
  },
};
