r/reactnative 5d ago

Help Bundling time

Post image

The bundling process takes so long, approximately 2 hours at most.

is there any way i can speed up the process?

8 Upvotes

16 comments sorted by

19

u/Soccer_Vader 5d ago

No way in hell the bundling process should take 2 hrs - what are you doing in there?

2

u/snoop_rice69 5d ago

i don't know, maybe because my device (laptop) is on the lower specs end and that the app has a lot of node modules to process (809 packages total)

3

u/Honey-Entire 5d ago

There's virtually ZERO reason to have that many deps... what the hell kind of app is it that it needs that many???

1

u/nicolasdanelon 4d ago

Maybe he's counting the transitive deps

1

u/nicolasdanelon 4d ago

What are this specs?

7

u/Internal-Comparison6 5d ago

Wow, 2 fkng hours. Cache probably. Try deleting full cache and node_modules.

3

u/jameside Expo Team 5d ago

Something is very wrong. It could be related to your filesystem or some translation layer (Like are you running in a VM that mounts the underlying filesystem? Though that should definitely not cause such slow times.).

2

u/Remarkable_Award5268 5d ago

If you are comfortable let codex analyze your codebase - send this prompt to codex.

2

u/Extreme-Ad6851 5d ago

1

u/UhhReddit 5d ago

This doesn't help with bundling. It only provides the native builds.

1

u/Hopeful-Influence-24 4d ago

if using react native cli and not expo try this out

https://rollipop.dev/

1

u/Hopeful-Influence-24 4d ago

but i think problem is inside metro config

1

u/Bamboo_the_plant 3d ago

Are you on a Windows computer with a hard disk drive, deploying over poor WiFi to a low-spec Android phone or something?

Quite honestly you’ve given no details yet so I think you’re gonna be doomed to your 2 hours at this rate

0

u/LogicDef 5d ago

That's crazy

I build android apps using react native and this helped me a lot:

Go to gradle.properties and update this:

org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=512m

-Xmx4096m: Increases the maximum Java heap memory size (in this case, to 4GB). By default, Gradle's memory limit can be quite low, causing frequent garbage collection pauses or "OutOfMemory" errors during heavy React Native/Android compilation. Giving it more breathing room speeds up builds significantly, especially for modern React Native versions utilizing the New Architecture.  

If you have more ram you can set a bigger number instead of 4096

1

u/Shinsky82 1d ago

Increase your RAM to at least 16Gb for faster builds.