Metro bundle extremely slow and gets stuck with babel v7.17.x
See original GitHub issueDescription
I had a huge issue bundling the app for development and production as soon as I updated the following packages to the latest version:
"@babel/core": "7.16.12",
"@babel/plugin-proposal-decorators": "7.16.7",
"@babel/runtime": "7.16.7",
"babel-jest": "27.5.1",
"metro-react-native-babel-preset": "0.67.0",
Basically, one of the mentioned packages is causing metro to bundle extremely slow and finally get stuck at approximately 90%.
After I reverted the package.json
back to an older version, it still didn’t help because of the ^
. I had to remove ^
from the packages I mentioned, and it was back to normal.
I’m guessing it’s a babel issue (I also updated React Native to 0.67.3), but I think you guys should know, I spent all day yesterday trying to resolve this (I also looked on here) without any luck.
Also, after all of that I was required to install 2 additional packages:
"@babel/plugin-transform-arrow-functions": "7.16.7",
"@babel/plugin-transform-shorthand-properties": "7.16.7",
Version
0.67.3
Output of npx react-native info
System:
OS: macOS 12.2.1
CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
Memory: 606.40 MB / 16.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 16.14.0 - /usr/local/bin/node
Yarn: 1.22.17 - /usr/local/bin/yarn
npm: 8.5.2 - /usr/local/bin/npm
Watchman: 2022.02.21.00 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.11.2 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
Android SDK:
API Levels: 30, 31
Build Tools: 30.0.2, 31.0.0, 32.0.0
System Images: android-30 | Google Play Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: Bumblebee 2021.1.1 Patch 2 Bumblebee 2021.1.1 Patch 2
Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_292 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: 17.0.2 => 17.0.2
react-native: 0.67.3 => 0.67.3
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Steps to reproduce
Running npx react-native start
after updating all the packages to the latest version.
Snack, code example, screenshot, or link to a repository
No response
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:13 (1 by maintainers)
Top GitHub Comments
This seems to only happen for iOS release builds for me, which seems weird.
Metro takes about 40 seconds to build the bundle for Android release builds, but takes about 10 minutes for the iOS release builds. Development build times are normal.
Can this help to narrow the possible cause?
Thanks @milos201, it took us 2 days to find out what was going on, hopefully this gets fixed soon as it’s extremely hard to spot the issue.