mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-28 05:10:17 +08:00
- Rather than in the webpack config, set it in babel, so that there aren't multiple loaders and instead just the plugin is added together with the presets. Examples were moved to cra-kitchen-sink because official removes the babel-loader taht comes from storybook.
35 lines
846 B
JavaScript
35 lines
846 B
JavaScript
const path = require('path');
|
|
|
|
module.exports = {
|
|
stories: ['../src/stories/**/*.stories.@(js|mdx)'],
|
|
logLevel: 'debug',
|
|
reactOptions: {
|
|
fastRefresh: true,
|
|
},
|
|
addons: [
|
|
'@storybook/preset-create-react-app',
|
|
{
|
|
name: '@storybook/addon-docs/preset',
|
|
options: {
|
|
configureJSX: true,
|
|
},
|
|
},
|
|
'@storybook/addon-actions',
|
|
'@storybook/addon-links',
|
|
'@storybook/addon-events',
|
|
'@storybook/addon-knobs',
|
|
'@storybook/addon-backgrounds',
|
|
'@storybook/addon-a11y',
|
|
'@storybook/addon-jest',
|
|
],
|
|
webpackFinal: (config) => {
|
|
// add monorepo root as a valid directory to import modules from
|
|
config.resolve.plugins.forEach((p) => {
|
|
if (Array.isArray(p.appSrcs)) {
|
|
p.appSrcs.push(path.join(__dirname, '..', '..', '..'));
|
|
}
|
|
});
|
|
return config;
|
|
},
|
|
};
|