File tree Expand file tree Collapse file tree
packages/react-native/scripts/codegen Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -311,12 +311,27 @@ function findNotLinkedLibraries(projectRoot) {
311311 Object . keys ( rnConfig . dependencies ) . forEach ( name => {
312312 const dependency = rnConfig . dependencies [ name ] ;
313313 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 => {
315329 if ( dependency . platforms [ platform ] == null ) {
316330 notLinkedPlatforms . push ( platform ) ;
317331 }
318332 } ) ;
319333 notLinkedLibraries [ name ] = notLinkedPlatforms ;
334+
320335 } ) ;
321336 return notLinkedLibraries ;
322337}
You can’t perform that action at this time.
0 commit comments