buster/apps/web/.storybook/main.ts

29 lines
920 B
TypeScript
Raw Normal View History

2025-08-08 00:31:57 +08:00
import { createRequire } from "node:module";
import path, { dirname, join } from 'node:path';
2025-02-22 05:13:15 +08:00
import type { StorybookConfig } from '@storybook/nextjs';
2025-08-08 00:31:57 +08:00
const require = createRequire(import.meta.url);
2025-02-22 05:13:15 +08:00
const config: StorybookConfig = {
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
2025-08-08 00:31:57 +08:00
addons: [getAbsolutePath("@chromatic-com/storybook"), getAbsolutePath("@storybook/addon-docs")],
2025-02-22 05:13:15 +08:00
framework: {
2025-08-08 00:31:57 +08:00
name: getAbsolutePath("@storybook/nextjs"),
2025-02-22 05:13:15 +08:00
options: {}
},
2025-04-12 01:21:31 +08:00
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;
}
2025-02-22 05:13:15 +08:00
};
export default config;
2025-08-08 00:31:57 +08:00
function getAbsolutePath(value: string): any {
return dirname(require.resolve(join(value, "package.json")));
}