FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

Hey there!

I have a Gridsome project that generates 7k+ pages in a multilanguage website, more languages will be added soon. However, when trying to build on Cloudflare Pages, I am getting the following message and the build process fail:
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

I really can use some help please!

Stefan