Add optional chaining to builder check
MODIFY
bin-src/lib/getStorybookMetadata.ts
bin-src/lib/getStorybookMetadata.ts
@@ -157,7 +157,7 @@ const findConfigFlags = async ({ options, packageJson }) => {
export const findBuilder = async (mainConfig) => {
let name = 'webpack4'; // default builder in Storybook v6
- if (mainConfig?.core.builder) {
+ if (mainConfig?.core?.builder) {
const { builder } = mainConfig.core;
name = typeof builder === 'string' ? builder : builder.name;
}

Add optional chaining to builder check