简体   繁体   中英

React Native Expo building very slowly

I've recently noticed my build time has increased considerably, sometimes taking a full minute to load. On the console I still see "Building JavaScript bundle: finished" fairly quickly but the screen takes much longer to refresh. Is there a reason something like this would be happening?

Try using Expo in a Simulator on your development machine and determine if it is taking as long as on your device:

  • If it is faster than on your test device, then you should check the network connection on your test device
  • If it is as slow as on the test device, then you could try to remove node_modules and reinstall them with 'npm install' or 'yarn'. Expo will be redownloaded aswell as all other packages.

In my case, it was a different solution.

I followed the instructions given by jimmylee on the Expo SDK forums , which say:

If you are behind a VPN, try disabling the VPN.

If you are using windows 10, run CMD on your machine and type ipconfig. Take a look at the first Ethernet Adapter. If it doesn't say Ethernet Adapter Ethernet it means Expo is taking the IP address of something else.

To fix this, go to network connections and disable the adapter that it should not be pointing at.

Connect your computer to the network and your phone to the same network. Restart Expo.

So, go to Settings > Network & Internet.

Click Change Adapter Options:

单击更改适配器选项

Then disable the unneeded Ethernet:

然后禁用不需要的以太网

Then restart Expo.

If the connection is made but bundle building is very slow - Try disconnecting from the network both devices, the system and the mobile, and reconnect. Also, don't forget to clear the 'recently in development' projects and start the project again. It will certainly increase the speed of building by far, especially for windows it works very well.

I was going through the same problem.

I used expo on multiple devices and clearly it depends on the device also, ie, whether it is able to handle it or not.

Second, for the slow device, i came up with a solution.

I just turned off the fast Refresh .

Fast Refresh keeps a watch on the development side and keeps reloading whenever we make a change.

By deactivating it, we need to refresh the app on our own. But this helped me.

Due to multiple refreshes and continuous bundling, expo gets slow (as per me) thus disabling this feature may help (infact helped me a lot).

STEPS TO DO THAT;

In your expo go app, shake your device. An option panel will open.

There will be an option to disable fast refresh . Simply click that and you are done.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM