Skip to content

Instantly share code, notes, and snippets.

@amcdnl
Created May 15, 2024 16:03
Show Gist options
  • Save amcdnl/485aaab71d41940e0958e1029104a522 to your computer and use it in GitHub Desktop.
Save amcdnl/485aaab71d41940e0958e1029104a522 to your computer and use it in GitHub Desktop.
const { webpack } = require('@storybook/csf-plugin');
const withNextra = require('nextra')({
theme: 'nextra-theme-docs',
themeConfig: './theme.config.tsx'
});
module.exports = async () => {
const { ReactDocgenTypeScriptPlugin } = await import('@storybook/react-docgen-typescript-plugin');
return withNextra({
reactStrictMode: true,
eslint: {
ignoreDuringBuilds: true
},
webpack: (config, _options) => {
return {
...config,
module: {
...(config.module ?? {}),
rules: [
...(config.module?.rules ?? []),
{
test: /\.(cjs|mjs|tsx?|jsx?)$/,
enforce: 'pre',
loader: require.resolve('@storybook/preset-react-webpack/dist/loaders/react-docgen-loader'),
options: {
debug: true,
},
exclude: /(\.(stories|story)\.(js|jsx|ts|tsx))|(node_modules)/,
},
],
},
plugins: [
...(config.plugins || []),
webpack({}),
new ReactDocgenTypeScriptPlugin({
savePropValueAsString: true
})
]
};
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment