Out of memory or out of time when compiling large JS files
See original GitHub issueDo you want to request a feature or report a bug? Bug.
What is the current behavior? Metro will either run out of memory or it will give up after 5 minutes of waiting to transform the JS file.
This was first reported here https://github.com/facebook/react-native/issues/8475 and then again here https://github.com/facebook/react-native/issues/12590
If the current behavior is a bug, please provide the steps to reproduce and a minimal repository on GitHub that we can yarn install
and yarn test
.
I have a repro repo here https://github.com/jeaye/react-native-packager-bug – it’s not in the yarn
format, since I don’t know what that is.
What is the expected behavior? The transformation completes in a timely fashion or metro waits long enough for the transformation to finish in however long it needs. In order to achieve the latter, my production build script currently contains the following:
metro=../node_modules/metro-bundler/src/JSTransformer/index.js
sed -i 's/\(TRANSFORM_TIMEOUT_INTERVAL\) = .*;/\1 = 901000;/g' "$metro" || true
Please provide your exact Metro configuration and mention your Metro, node, yarn/npm version and operating system.
React Native: 0.50.4 babel-preset-react-native: 4.0.0 Metro (comes with RN): 0.20.3 Node: 9.3.0 OS: Arch Linux x86_64
Issue Analytics
- State:
- Created 6 years ago
- Reactions:10
- Comments:25 (6 by maintainers)
Top GitHub Comments
@roesneb It certainly shouldn’t be closed. It was ignored when it was reported, multiple times, in the react native repo, while people suggested it be brought up here. Now that it’s brought up here, it’s promptly closed and no workarounds are available (for people using ClojureScript).
For your problem, you might try ignoring that JSON file using your babelrc. Alas, if it has a common name, then all JSONs with that name will be ignored, which is the last problem about which I asked @rafeca.
Why is this issue closed? I have a json file with 17.4MB. If i require it the bundler crashes and if comment it out everything works fine. This seems to be a common problem. Is there a solution for this issue?
“FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory”