When I try to use aws-sdk in React-Native app, I faced to JavaScript heap out of memory when trying to run my application. I passed almost five days searching over the internet to find a solution to my problem. I remarked that this problem was general and most people have it.
Among all solutions that I try, only one solves my problem. It’s time to show you which. I use react 17.0.2 and react-native 0.65.1.
The previous image shows the structure of my react native project. To solve our issue caused by aws-react-native.js, we must ignore it in Babel config.
To do that, we just open file babel.config.js and append this in babel configuration:
“ignore”: [“./aws-sdk-js/dist/aws-sdk-react-native.js”]
In your case, you must change the path ./aws-sdk-js/dist/aws-sdk-react-native.js with the path of the file you want to ignore. If your file is located in node_modules, you must write like this:
“ignore”: [“node_modules/aws-sdk-js/dist/aws-sdk-react-native.js”]
this complete babel configuration is:
module.exports = {
presets: [‘module:metro-react-native-babel-preset’],
“ignore”: [“./aws-sdk-js/dist/aws-sdk-react-native.js”]
};
I hope this manipulation will work for you and save you time.
I am a Master’s student in computer science passionate about DevOps, Cloud Computing, AI, and BI. I am also a web developer, especially with Django and Laravel Frameworks. I love to share things that work for me with others to save them time searching through the internet to solve the same problem.