File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
packages/react-native/scripts/codegen Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -311,12 +311,27 @@ function findNotLinkedLibraries(projectRoot) {
311
311
Object . keys ( rnConfig . dependencies ) . forEach ( name => {
312
312
const dependency = rnConfig . dependencies [ name ] ;
313
313
let notLinkedPlatforms = [ ] ;
314
- Object . keys ( dependency . platforms ) . forEach ( platform => {
314
+
315
+ // dependency.platforms might not be defined, as the format
316
+ // {
317
+ // "dependencies": {
318
+ // "dependency-name": {
319
+ // "root": "path/to/dependency",
320
+ // }
321
+ // }
322
+ // }
323
+ // is also supported.
324
+ // In this case, we assume that the library is linked to all platforms.
325
+ // We don't consider the case were `dependency-name.root` is equal to `null`, because that
326
+ // means that the library is not linked to the app at all, and in that case the dependency
327
+ // should be removed by the user.
328
+ dependency . platforms && Object . keys ( dependency . platforms ) . forEach ( platform => {
315
329
if ( dependency . platforms [ platform ] == null ) {
316
330
notLinkedPlatforms . push ( platform ) ;
317
331
}
318
332
} ) ;
319
333
notLinkedLibraries [ name ] = notLinkedPlatforms ;
334
+
320
335
} ) ;
321
336
return notLinkedLibraries ;
322
337
}
You can’t perform that action at this time.
0 commit comments