File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed
packages/cli-platform-android/src/config Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -32,11 +32,29 @@ export default function getPackageClassName(folder: string) {
32
32
let files = getMainActivityFiles ( folder ) ;
33
33
let packages = getClassNameMatches ( files , folder ) ;
34
34
35
- if ( ! packages . length ) {
36
- files = getMainActivityFiles ( folder , false ) ;
37
- packages = getClassNameMatches ( files , folder ) ;
35
+ if ( packages && packages . length > 0 && Array . isArray ( packages [ 0 ] ) ) {
36
+ return packages [ 0 ] [ 1 ] ;
38
37
}
39
38
39
+ /*
40
+ When module contains `expo-module.config.json` we return null
41
+ because expo modules follow other practices and don't implement
42
+ ReactPackage/TurboReactPackage directly, so it doesn't make sense
43
+ to scan and read hundreds of files to get package class name.
44
+
45
+ Exception is `expo` package itself which contains `expo-module.config.json`
46
+ and implements `ReactPackage/TurboReactPackage`.
47
+
48
+ Following logic is done due to performance optimization.
49
+ */
50
+
51
+ if ( fs . existsSync ( path . join ( folder , '..' , 'expo-module.config.json' ) ) ) {
52
+ return null ;
53
+ }
54
+
55
+ files = getMainActivityFiles ( folder , false ) ;
56
+ packages = getClassNameMatches ( files , folder ) ;
57
+
40
58
// @ts -ignore
41
59
return packages . length ? packages [ 0 ] [ 1 ] : null ;
42
60
}
You can’t perform that action at this time.
0 commit comments