import { createRequire } from "node:module"; import path, { dirname, join } from 'node:path'; import type { StorybookConfig } from '@storybook/nextjs'; const require = createRequire(import.meta.url); const config: StorybookConfig = { stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'], addons: [getAbsolutePath("@chromatic-com/storybook"), getAbsolutePath("@storybook/addon-docs")], framework: { name: getAbsolutePath("@storybook/nextjs"), options: {} }, staticDirs: ['../public'], webpackFinal: async (config) => { config.resolve = config.resolve || {}; config.resolve.alias = { ...(config.resolve.alias || {}), 'next/navigation': path.resolve(__dirname, './mocks/next-navigation.ts') }; return config; } }; export default config; function getAbsolutePath(value: string): any { return dirname(require.resolve(join(value, "package.json"))); }