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

29 lines
901 B
TypeScript
Raw Normal View History

2025-08-08 02:26:58 +08:00
import { createRequire } from 'node:module';
2025-08-08 00:31:57 +08:00
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 = {
2025-08-14 00:34:23 +08:00
stories: ['../src/**/*.stories.@(js|jsx|mjs|ts|tsx)'],
2025-08-08 02:26:58 +08:00
addons: [getAbsolutePath('@chromatic-com/storybook'), getAbsolutePath('@storybook/addon-docs')],
2025-02-22 05:13:15 +08:00
framework: {
2025-08-08 02:26:58 +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 {
2025-08-08 02:26:58 +08:00
return dirname(require.resolve(join(value, 'package.json')));
2025-08-08 00:31:57 +08:00
}