Seeing this error after running the SB7 migration, searching turns up nothing here or in Google/SO. Our main.js is:
import { dirname, join } from 'path'
module.exports = {
stories: [],
addons: [
getAbsolutePath('@storybook/addon-essentials'),
{
name: '@storybook/addon-styling',
options: {
postcssLoaderOptions: {
implementation: require('postcss'),
},
},
},
getAbsolutePath('@storybook/addon-a11y'),
getAbsolutePath('storybook-fixtures'),
getAbsolutePath('storybook-react-i18next'),
getAbsolutePath('@storybook/addon-docs'),
getAbsolutePath('storybook-addon-react-docgen'),
],
features: {
buildStoriesJson: true,
},
typescript: {
check: false,
checkOptions: {},
reactDocgen: 'react-docgen-typescript',
reactDocgenTypescriptOptions: {
shouldExtractLiteralValuesFromEnum: true,
propFilter: (prop) => (prop.parent ? !/node_modules/.test(prop.parent.fileName) : true),
},
},
webpackFinal: async (config, { configType }) => {
config.optimization = {
minimize: false,
minimizer: [],
}
return config
},
framework: {
name: getAbsolutePath('@storybook/react-webpack5'),
options: {},
},
}
/**
* This function is used to resolve the absolute path of a package.
* It is needed in projects that use Yarn PnP or are set up within a monorepo.
*/
function getAbsolutePath(value) {
return dirname(require.resolve(join(value, 'package.json')))
}