react-native-safe-area-context icon indicating copy to clipboard operation
react-native-safe-area-context copied to clipboard

Move to expo-module-scripts for web tree shaking

Open nandorojo opened this issue 4 years ago • 2 comments

Summary

Close #188 by moving the build script over to expo-module-scripts.

Test Plan

I'm going to publish under my own scope and install it in my app to make sure that the tree shaking does in fact work. The changes in this PR are little more than chores for build scripts, and moving some files around.

nandorojo avatar Apr 07 '21 20:04 nandorojo

Looks like some tests are failing. Let me know what you need me to do to solve that.

nandorojo avatar Apr 07 '21 20:04 nandorojo

Published to @nandorojo/react-native-safe-area-context at version 3.2.1. I can confirm this has a significant impact on tree shaking. Here's my next.js bundle analyzer:

- import { SafeAreaProvider } from 'react-native-safe-area-context'
+ import { SafeAreaProvider } from '@nandorojo/react-native-safe-area-context'

This one change reduced my bundle size by 400kb, which is quite significant for web.

Before

Screen Shot 2021-04-07 at 5 22 24 PM

After

Screen Shot 2021-04-07 at 5 21 31 PM

nandorojo avatar Apr 07 '21 21:04 nandorojo

Thanks for taking the time to look at this. I'm not certain this is still an issue - but also - I don't think this project differs much from the generated boilerplate. The advantage of staying very close to the boilerplate is major upgrades are much easier. We may very well have to look into bringing in the latest boiler plate for the new architecture updates.

So appreciate the time you put into this, but I don't think this is the right direction

jacobp100 avatar Jan 19 '23 17:01 jacobp100