From 3f537f1daf4cf01269ea00e665ed4dd0be550e27 Mon Sep 17 00:00:00 2001 From: Ritesh Kumar Shukla <75062358+riteshshukla04@users.noreply.github.com> Date: Tue, 10 Dec 2024 15:41:26 +0530 Subject: [PATCH] fix: don't crash if codegenConfig is not defined in package.json (#716) This will prevent undefined from being thrown as error and actual error will be thrown. https://github.com/callstack/react-native-builder-bob/issues/713 Co-authored-by: Ritesh Shukla2 --- .../src/utils/patchCodegenAndroidPackage.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/react-native-builder-bob/src/utils/patchCodegenAndroidPackage.ts b/packages/react-native-builder-bob/src/utils/patchCodegenAndroidPackage.ts index 9a0acb462..1868ad256 100644 --- a/packages/react-native-builder-bob/src/utils/patchCodegenAndroidPackage.ts +++ b/packages/react-native-builder-bob/src/utils/patchCodegenAndroidPackage.ts @@ -20,7 +20,7 @@ export async function patchCodegenAndroidPackage( report: Report ) { let codegenAndroidPath: string | undefined = - packageJson.codegenConfig.outputDir.android; + packageJson.codegenConfig?.outputDir?.android; if (!codegenAndroidPath) { throw new Error( `Your package.json doesn't contain codegenConfig.outputDir.android. Please see ${CODEGEN_DOCS}`