@@ -0,0 +1,47 @@
|
||||
import type { StorybookConfig } from 'storybook-react-rsbuild';
|
||||
|
||||
/* Dev-only playground. Never shipped — package `files` is ["dist"]. */
|
||||
const config: StorybookConfig = {
|
||||
rsbuildFinal: (config) => {
|
||||
config.tools ??= {};
|
||||
// Append our rule without clobbering storybook-react-rsbuild's own
|
||||
// tools.rspack hook (it injects the storybook-config-entry virtual module
|
||||
// in build mode). Mutate in place and return nothing so its config stays.
|
||||
const prev = config.tools.rspack;
|
||||
config.tools.rspack = [
|
||||
...(Array.isArray(prev) ? prev : prev ? [prev] : []),
|
||||
(rspackConfig) => {
|
||||
rspackConfig.module ??= {};
|
||||
rspackConfig.module.rules ??= [];
|
||||
(rspackConfig.module.rules as unknown[]).push({
|
||||
test: /\.mjs$/,
|
||||
type: 'javascript/auto',
|
||||
resolve: { fullySpecified: false },
|
||||
});
|
||||
},
|
||||
];
|
||||
return config;
|
||||
},
|
||||
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(ts|tsx)'],
|
||||
addons: ['@storybook/addon-docs'],
|
||||
staticDirs: ['../src/assets'],
|
||||
framework: {
|
||||
name: 'storybook-react-rsbuild',
|
||||
options: {},
|
||||
},
|
||||
typescript: {
|
||||
// Prop tables in autodocs come from the components' TS types.
|
||||
reactDocgen: 'react-docgen-typescript',
|
||||
reactDocgenTypescriptOptions: {
|
||||
shouldExtractLiteralValuesFromEnum: true,
|
||||
// Keep our own props + Radix primitives; drop other node_modules noise.
|
||||
propFilter: (prop) =>
|
||||
prop.parent
|
||||
? !/node_modules/.test(prop.parent.fileName) ||
|
||||
/node_modules\/radix-ui/.test(prop.parent.fileName)
|
||||
: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
||||
Reference in New Issue
Block a user