@@ -100,20 +100,26 @@ function cleanupEmptyFilesAndFolders(filepath /*: string */) {
100
100
function readGeneratedAutolinkingOutput (
101
101
baseOutputPath /*: string */ ,
102
102
) /*: $FlowFixMe */ {
103
- // NOTE: Generated by scripts/cocoapods/autolinking.rb in list_native_modules (called by use_native_modules)
104
- const autolinkingGeneratedPath = path . resolve (
103
+ const basePathOptions = [
104
+ // The `outputDir` may not be set correctly if it's set to the a temporary output directory
105
+ process . env . RCT_SCRIPT_OUTPUT_DIR ,
106
+ // NOTE: Generated by scripts/cocoapods/autolinking.rb in list_native_modules (called by use_native_modules)
105
107
baseOutputPath ,
106
- 'build/generated/autolinking/autolinking.json' ,
107
- ) ;
108
- if ( fs . existsSync ( autolinkingGeneratedPath ) ) {
109
- // $FlowFixMe[unsupported-syntax]
110
- return require ( autolinkingGeneratedPath ) ;
111
- } else {
108
+ ] . filter ( ( item ) => ! ! item ) ;
109
+ for ( const basePath of basePathOptions ) {
110
+ const autolinkingGeneratedPath = path . resolve (
111
+ basePath ,
112
+ 'build/generated/autolinking/autolinking.json' ,
113
+ ) ;
114
+ if ( fs . existsSync ( autolinkingGeneratedPath ) ) {
115
+ // $FlowFixMe[unsupported-syntax]
116
+ return require ( autolinkingGeneratedPath ) ;
117
+ }
112
118
codegenLog (
113
119
`Could not find generated autolinking output at: ${ autolinkingGeneratedPath } ` ,
114
120
) ;
115
- return null ;
116
121
}
122
+ return null ;
117
123
}
118
124
119
125
function readReactNativeConfig (
0 commit comments