Metro bundle extremely slow and gets stuck with babel v7.17.x
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 5.6k
- Forks
- 696
- Avg merge
- 8m
- Merged PRs (30d)
- 7
Description
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the package versions in package.json and reproduce the problem by running npx react-native start with the listed Babel and React Native versions. Compare bundling with the caret ranges and pinned versions, then narrow down which package causes the stall; done means the regression is identified and bundling no longer gets stuck near 90%.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react-native
- Domain
- build-system, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100