bndkt / react-native-app-clip

Easily add an App Clip for iOS apps built with React Native
https://bndkt.com/blog/2022/react-native-app-clip
504 stars 25 forks source link

`excludedPackages` doesn't work #27

Closed nathan-ahn closed 2 days ago

nathan-ahn commented 1 year ago

Findings

I ran two tests to determine that excludedPackages isn't working. Both using react-native-skia which is known to have a significant iOS bundle size of ~5.8 MB. Resulting bundle sizes are determined using App Thinning Size Report.txt as recommend by Apple.

Test 1

Including "@shopify/react-native-skia" in excludedPackages yields an uncompressed size of 27.7 MB. Removing it yields the same uncompressed size of 27.7 MB

Test 2

As in the previous test, including "@shopify/react-native-skia" in excludedPackages yields an uncompressed size of 27.7 MB. I uninstall @shopify/react-native-skia completely and got an uncompressed bundle size of 21.8 MB. According to Shopify, the JavaScript bundle is only supposed to account for 220 KB (and likely 0 KB in our case given that it was never imported). So the size discrepancy is almost definitely due to properly removed native code.

Additional Note

ios/Pods/Podfile generates correctly with "@shopify/react-native-skia" being included in exclude.

david-arteaga commented 1 year ago

btw I've tested with v0.1.4 and excludedPackages does work as expected. I archived a build without any packages in that list -- got about 55MB Then added a bunch of packages in our project to excludedPackages, archived again -- got about 26MB

So the issue may have been introduced after v0.1.4

nathan-ahn commented 3 months ago

Going to experiment, but I think there's a good chance this issue is related to this commit.

nathan-ahn commented 3 days ago

This issue only affects non-Expo modules. Expo modules are correctly handled with use_expo_modules's exclude field, but non-Expo modules are going to require a custom implementation.

nathan-ahn commented 2 days ago

Fixed in #50.