In this post, we will see how to resolve React – Import big JSON file – Memory Error HEAP
I have a working react app with a relatively small footprint. However I want to import a JSON file in my React-App with lots of data. The file size is 80MB.
I import the file using: import MYJSON from ‘./myfile.json’
What I’ve tested is increasing my memory for the react app to 12GB.
“node –max-old-space-size=12000 node_modules/.bin/react-scripts start”
How can it be that an 80MB file raise the memory footprint of node from under 4GB to over 12GB with a single 80MB JSON file import and the app didn’t start or build?
Thanks for your help!
Best Answer:80MB should not be a problem, but anyway you can try to open it using
Hope it helps.
If you have better answer, please add a comment about this, thank you!