Aws-sdk, React-Native and JavaScript heap out of memory

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”]
    };
babel.config.js

I hope this manipulation will work for you and save you time.

DERICK TEMFACK

<span class="router-outlet-wrapper ng-tns-c950005113-0"><span class="ng-star-inserted">Hi, I'm Derick. I am a Software Engineer and DevOps pro. I specialize in turning complex business needs into </span><span class="ng-star-inserted">automated workflows</span><span class="ng-star-inserted"> using Python, Odoo, and Go. I write </span><span class="ng-star-inserted">engineering case studies</span><span class="ng-star-inserted"> here—sharing the architectural decisions and real-world code behind the solutions I build.</span></span>

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top