@@ -210,29 +210,38 @@ function readOutputDirFromPkgJson(
210210
211211function computeOutputPath (
212212 projectRoot /*: string */ ,
213- baseOutputPath /*: string | void | null */ ,
213+ optionalBaseOutputPath /*: string | void | null */ ,
214214 pkgJson /*: $FlowFixMe */ ,
215215 platform /*: string */ ,
216- ) {
217- if ( baseOutputPath == null ) {
216+ ) /*: string */ {
217+ let baseOutputPath /*: string */ ;
218+ if ( optionalBaseOutputPath == null ) {
218219 const outputDirFromPkgJson = readOutputDirFromPkgJson ( pkgJson , platform ) ;
219220 if ( outputDirFromPkgJson != null ) {
220- // $FlowFixMe[reassign-const]
221221 baseOutputPath = path . join ( projectRoot , outputDirFromPkgJson ) ;
222222 } else {
223- // $FlowFixMe[reassign-const]
224223 baseOutputPath = projectRoot ;
225224 }
225+ } else {
226+ baseOutputPath = optionalBaseOutputPath ;
226227 }
227228 if ( pkgJsonIncludesGeneratedCode ( pkgJson ) ) {
228229 // Don't create nested directories for libraries to make importing generated headers easier.
229230 return baseOutputPath ;
230231 }
231232 if ( platform === 'android' ) {
232- return defaultOutputPathForAndroid ( baseOutputPath ) ;
233+ return defaultOutputPathForAndroid (
234+ baseOutputPath != null && baseOutputPath . length > 0
235+ ? baseOutputPath
236+ : projectRoot ,
237+ ) ;
233238 }
234239 if ( platform === 'ios' ) {
235- return defaultOutputPathForIOS ( baseOutputPath ) ;
240+ return defaultOutputPathForIOS (
241+ baseOutputPath != null && baseOutputPath . length > 0
242+ ? baseOutputPath
243+ : projectRoot ,
244+ ) ;
236245 }
237246 return baseOutputPath ;
238247}
0 commit comments