React app fails on Heroku with JS heap allocation error

32 views Asked by At

I have a React app, using the d3-org-chart package, which runs fine locally. However, when deployed to Heroku, on startup it produces a

JavaScript heap out of memory - allocation error

The allocated heap size on Heroku is 1024MB, however, locally, even when I do restrict the heap size to the same limit

"start": "react-scripts --max_old_space_size=1024 start",
"build": "react-scripts --max_old_space_size=1024 build"

it runs. When testing locally, the app doesn't require more than ~50MB, not even close to the limit set up on Heroku.

Is there a reason for the different behavior locally and when deployed? I cannot change the memory size limit on Heroku, so that is not a solution for me.

0

There are 0 answers